Home :: The Java Grinder :: Coffee Talk :: Newest Nodes :: Library
User Options: Guest User :: Log Out

Grinder

Post a Question
class File has wrong version 1 replies
posted: Tue Jan 12 2010 at 17:01
AaronD

Folks, I am having a problem with packages I think. I am running JDK 1.6.0_17-b04 supportproj1.jbx +<Project Source> nw.support.common nw.support.display nw.support.config nw.support.data then a bunch of jar files.... Cannot Access abc.logging.abcLogger; bad class file C:...'abcLogger.class, class file has wrong version 50.0, should be 49.0, Please remove or make sure it appears in the correct subdirectory of the classpath. I think this is a problem with my IDE. In the required Libraries, the jar file that contains abcLogger., abc.jar is listed. When I start typing abc.logging.abcLogger it picks up and auto fills it in. So it obviously finds it.

Offer Your Reply
 
cannot find symbol class 1 replies
posted: Fri Oct 9 2009 at 13:01
stv808

I am learning Java and have run into the following error: cannot find symbol class book I am creating a Book class and a BookTest driver to test it. The following is the Book class: public class Book { //declare variables String title; String author; String publisher; //constructors public Book() { setTitle(""); setAuthor(""); setPublisher(""); } public Book(String title, String author, String publisher) { setTitle(title); setAuthor(author); setPublisher(publisher); } //accessors public void setTitle(String Title) { title = checkForNull_setToEmpty(title); } public String getTitle() { return title; } public void setAuthor(String Author) { author = checkForNull_setToEmpty(author); } public String getAuhtor() { return author; } public void setPublisher(String Publisher) { publisher = checkForNull_setToEmpty(publisher); } public String getPublisher() { return publisher; } public String checkForNull_setToEmpty(String sIn) { if (sIn == null) sIn = ""; return sIn; } //toString public String toString() { return (title + "\n" + author + "\n" + publisher); } } The following is the driver: public class BookTest { //instantiate public static void main(String args) { Book bk1 = new Book(); bk1.setTitle("Hardcore Inventing"); bk1.setAuthor("Robert Yonover"); bk1.setPublisher("Skyhorse Publishing"); System.out.println(bk1.toString()); Book bk2 = new Book(); bk2.setTitle("The E Myth Revisited"); bk2.setAuthor("Michael E. Gerber"); bk2.setPublisher("Harper Business"); System.out.println(bk1.toString()); //updates bk1.setTitle("Simple Inventing"); System.out.println(bk1.toString()); bk2.setAuthor("Francois Irving"); System.out.println(bk2.toString()); bk1.setPublisher("Morrow Publishing"); System.out.println(bk1.toString()); } } The error keeps pointing to Book bk1 = new Book(); also Book bk2 = new Book(); I'm stuck..Please help.

Offer Your Reply
 
New to java and have a question concerning symbols 1 replies
posted: Thu Jul 16 2009 at 23:39
tsullivan

Hello I am trying to teach myself java and have come across something I am not able to resolve. When compiling this I receive the error below error. Any help would be much appreciated. class TapeDeck { boolean canRecord = false; void playTape () { System.out.println("tape playing"); } void recordTape () { System.out.println("tape recording"); } } class TapeDeckTestDrive { public static void main (String args) { Tapedeck t = new Tapedeck(); t.canRecord = true; t.playTape(); if (t.canRecord == true){ t.recordTape(); } } } C:\Java stuff>javac TapeDeckTestDrive.java TapeDeckTestDrive.java:21: cannot find symbol symbol : class Tapedeck location: class TapeDeckTestDrive Tapedeck t = new Tapedeck(); ^ TapeDeckTestDrive.java:21: cannot find symbol symbol : class Tapedeck location: class TapeDeckTestDrive Tapedeck t = new Tapedeck();

Offer Your Reply
 
Light-weight Java web tools 2 replies
posted: Sat Mar 29 2008 at 00:22
Hyperbole

Hello everyone :)

I recently started tutoring undergraduate Java programmers in my University and I'm developing a program to track Tutors' and Students' activities.

When a Student signs in for a session they will be presented with a list of Computer Science courses and asked to choose which course they're sitting in a tutoring session for. I want this list to be automatically populated at the beginning of the semester from the University's web-based course archive.

I'm looking for a set of light-weight web tools that can fetch pages, fill forms and (possibly) parse HTML. Parsing doesn't necessarily need to be included but it wouldn't be a bad thing.

Are there any such tools available anywhere? I can't seem to find any.

Thanks in advance,

--Hyperbole

Offer Your Reply
 
Building a web crawler, but new to java, so I need some help! 2 replies
posted: Tue Feb 19 2008 at 20:05
downer

I'm comfortable with C++, C and perl, but Java is new to me. I'm building a multithreaded web crawler, but so far, Java isn't making this easy for me. First things first-

1)I have no idea how to make a bloom filter with out pointers, so I'm going to store seen pages in hash map. Are there built in facilities for a hash map in Java? (forgive the noob-ness of these questions).

2)I dont what to think about how to parse and deal with the robot exclusions, is there a package out there which does this in existance?

more to come for sure, but this is what I am stuck on now. Thanks for your help, Junkies

Offer Your Reply
 
Deserializing JSON back to my Java Bean? 0 replies
posted: Thu Jan 31 2008 at 15:24
Yendor

Good new Date(); Junkies,

I've been working on an application where I need to store a map or list of values of a bean object (POJO bean) into a database.

I could create a many-to-many mapping table between the User and the MenuItems that are the User's choices...But I would rather not. So I've been working with JSON and trying to serialize and deserialize my objects. I've tried using JSON-lib (http://json-lib.sourceforge.net/) and JSONTools (http://jsontools.berlios.de/). From my perspective, both seem to have their own problems, and in both cases, the problem arises when deserializing from a JSON String back into my object.

Perhaps a little code will help illustrate my cases...

   1: 
   2: public void testJsonSerializerList() {
   3:   try {
   4:     MenuItem one = new MenuItem("1", "com.mycompany.MainMenu", "+
menuItemOne");
   5:     MenuItem two = new MenuItem("2", "com.mycompany.MainMenu", "+
menuItemTwo");
   6:     List<MenuItem> sourceList = new ArrayList<MenuItem>();
   7:     sourceList.add(one);
   8:     sourceList.add(two);
   9: 
  10:     Marshall marshall = new JSONMarshall();
  11:     JSONObject result = marshall.marshall(sourceList);
  12:     MarshallValue value = marshall.unmarshall(result);
  13:     List<MenuItem> resultList = (ArrayList<MenuItem>) value.getR+
eference();
  14: 
  15:     assertEquals(resultList, sourceList);
  16:   } catch (MarshallException e) {
  17:     fail();
  18:   }
  19: }

The code above works, but at no point did I turn the JSONObject into a String, which is what I need for storing it to a text field in my Postgres database. So here's what it looks like when I try to take the same code above and Stringify it amidships:

   1: 
   2: public void testJsonSerializerList2() {
   3:   try {
   4:     MenuItem one = new MenuItem("1", "com.mycompany.MainMenu", "+
menuItemOne");
   5:     MenuItem two = new MenuItem("2", "com.mycompany.MainMenu", "+
menuItemTwo");
   6:     List<MenuItem> sourceList = new ArrayList<MenuItem>();
   7:     sourceList.add(one);
   8:     sourceList.add(two);
   9: 
  10:     Marshall marshall = new JSONMarshall();
  11:     JSONObject result = marshall.marshall(sourceList);
  12:     // Up to now, the code has been the same.
  13:     // Turn the JSON object into a String...
  14:     String jsonString = result.toString();
  15: 
  16:     // And here, how do I get it back to a JSONObject?
  17:     //JSONObject result2 = new JSONObject(jsonString);
  18:     JSONParser parser = new JSONParser(new StringReader(jsonStri+
ng));
  19:     // The JSONParser nextValue() method returns a JSONValue, no+
t a JSONObject.
  20:     // Therefore, this line does not even compile.
  21:     MarshallValue value = marshall.unmarshall(parser.nextValue()+
);
  22:     List<MenuItem> resultList = (ArrayList<MenuItem>) value.getR+
eference();
  23: 
  24:     assertEquals(resultList, sourceList);
  25:   } catch (MarshallException e) {
  26:     fail();
  27:   }
  28: }

And, for completeness' sake, here's my attempt at doing this same exercise using JSON-Lib instead of JSONTools:

   1: 
   2: public void testJsonLibSerializerList2() {
   3:   MenuItem one = new MenuItem("1", "com.mycompany.MainMenu", "me+
nuItemOne");
   4:   MenuItem two = new MenuItem("2", "com.mycompany.MainMenu", "me+
nuItemTwo");
   5:   List<MenuItem> sourceList = new ArrayList<MenuItem>();
   6:   sourceList.add(one);
   7:   sourceList.add(two);
   8: 
   9:   JSON object = JSONSerializer.toJSON(sourceList);
  10:   //JSONArray object = JSONArray.fromObject(sourceList);
  11: 
  12:   String jsonString = object.toString();
  13: 
  14:   JSONArray result = JSONArray.fromObject(jsonString);
  15:   List<MenuItem> resultList = (List<MenuItem>) JSONSerializer.to+
Java(result);
  16: 
  17:   assertEquals(sourceList, resultList);
  18: }

In this case, the deserialization works, but instead of having a List of MenuItem objects, I have a List of net.sf.ezmorph.bean.MorphDynaBean objects. (EZMorph is another library that JSON-Lib depends on.)

So the root question is...Does anyone have any ideas or thoughts on how I might go about this? Keep in mind that I am the only coder on this project, and I can make the code do whatever I want. Thinking outside the box is perfectly fine with me. What am I missing?

-Yendor

Offer Your Reply
 
Inner Classes in UML? 1 replies
posted: Wed Jan 23 2008 at 16:00
gregor42

It's odd, but I've never had to represent this before. What is the correct way - if any - to draw inner classes in UML?

I tried searching for it & I read that it should be avoided because UML shouldn't be language-specific and inner-classes are Java-specific.

Is that so?

Any suggestions?



Never Under-Estimate the Power of What Works!

- Gregor42

Offer Your Reply
 
displaying currency other than locale's default 2 replies
posted: Fri Dec 14 2007 at 20:17
meonkeys

I'm in the en_US locale, and I want to display some amount of Euros. Is there some industry standard for where to place the Euro symbol, what thousands separator, and what decimal point character to use?

Using java.text.NumberFormat, I can format the monetary value 1234.56 in Euros as follows:

   1: 
   2: import java.text.NumberFormat;
   3: import java.util.Locale;
   4: 
   5: class NFmt {
   6:   public static void main(String args[]) {
   7:     NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.FR+
ANCE);
   8:     String fmttt = nf.format(1234.56);
   9:     System.out.println(fmttt);
  10:   }
  11: }
This prints 1 234,56 €. But someone in the USA expects money to have a comma for the thousands separator and a period for the decimal point, even if I'm looking at some amount of Euros. Right?

same issue, applied in software

Offer Your Reply
 
Android 1 replies
posted: Sun Nov 18 2007 at 09:48
agent00013

Anybody checking all the Google Android stuff? I've started playing around with the SDK and Emulator. It's based on Java... first Java coding I've done in years, but I'm having fun with it! The Hello, Android application is fairly basic and there's other tutorials as well.

The hardest part is just getting Eclipse and the SDK installed properly and path variables updated, but the guide for that is good, too.

Offer Your Reply
 
Tomcat not finding a path? 0 replies
posted: Thu Aug 16 2007 at 16:26
Quicksilver

Dear JavaJunkies, I've just been given a project which requires Java so I'm now on a steep learning curve, so please do bear with me. I've got a calendaring system which runs using Tomcat and Ant and have come into difficulties with getting catalina to see a new context file which has different database details in it. The programme resides in C:\Foo but Ant points the user home directory (C:\Directories and Settings\userid which I believe equals {user.home}) which is where I have placed my build.properties files. This points to the build.properties. Within this I've pointed to the .properties and .options.xml into the same directory. In these I've set the tomcat.context properties to the new context.xml which has the new database details. However when I reload Tomcat, it is copying over the WAR files and ignoring the updated context.xml leaving me pointing to the incorrect db. I believe that I have an incorrectly formed path somewhere and would be grateful if somebody could help me find and fix this so I can understand how Java sees paths to places. I'm running the project on Windows.

Offer Your Reply
 
(0-10) of 413Next 10 entries...

Put your Question in the Grinder!
Title:

Your text:

NOTICE TO ALL USERS:
All information, data, text, software, music, sound, photographs, graphics, video, messages, or other materials ("Content") posted to this site by any users are the sole responsibility of those users. JavaJunkies does not guarantee the accuracy, integrity, or quality of such Content.

Tick tock
JavaJunkie time is :
Tue Sep 7 15:06:54 CEST 2010
Login Nodelet
Login:
Password

Don't have an account?
Create a new user
Forgot your password?

New Nodes
*CHRISTENSENEleanor
*MarshaSimon18
*HeadAdeline
*RoxieAlvarado
*Shiv
*AlyceMercado18
*DicksonCelia
*Warner31Maribel
*HernandezCandace
*ChapmanBobbie27
*RHEAGRAHAM18
*PollyParks24
*DianeJENSEN
*RichardErica
*PeggyWooten19
Java Links
*Java™ Standard Edition Platform Documentation
* DocFather
* Online Docs
* Sun's Java™ Tutorial
*Java™ 2 Platform SE v1.4.2
*
Java™ 2 Platform EE v1.4
*
Glossary of Java™ Related Terms
[*] Other Users
ain't nobody here

Maintained by root

Are you in the right place? Take a peak at the Post FAQ!
This web site is powered by the Everything Engine and hosted by Oakbox

Java™ and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U. S. and other countries. JavaJunkies is not affiliated with Sun Microsystems, Inc. in any way.