small medium large xlarge

Generic-user-small
26 Jun 2014, 05:24
Boogie Bob (4 posts)

Whenever i try and run the program on page 20 “java CreeperTest” I get this message, Error: Could not find or load main class CreeperTest Could anyone help me on that? Please Help!!

Andy-talking_pragsmall
26 Jun 2014, 22:28
Andrew Hunt (226 posts)

Hey Bob –

A little more info might help. Did the file compile ok? Do you see a CreeperTest.class file in the directory?

/\ndy

Generic-user-small
27 Jun 2014, 02:45
Boogie Bob (4 posts)

Ya :/ i saw the CreeperTest.class I tried doing: java CreeperTest java CreeperTest.java java CreeperTest.class The code im useing is: public class CreeperTest { public static void main(String args[]) { System.out.println(“That’sss a very niccce program you have there…”); } }

Thanks

Generic-user-small
27 Jun 2014, 02:45
Boogie Bob (4 posts)

also i dont know how to make it look neater

Andy-talking_pragsmall
27 Jun 2014, 14:38
Andrew Hunt (226 posts)

I don’t see a “javac” in there. Also check out page 22.

/\ndy

Generic-user-small
27 Jun 2014, 18:16
Boogie Bob (4 posts)

My bad page 20 is the page im referencing too

Generic-user-small
05 Jul 2014, 21:36
Noah David (4 posts)

when i open up up busy busy box and do cd desktop then javac CreeperTest.java it works but then when i do java CreeperTest i get this error.(This is the everything i did once i openned busybox, the error is what is bellow the line where i typed java CreeperTest.)

C:\Users\Lisa2\Desktop>c:\Windows\system32\cmd.exe /c sh.exe -l

~ $ cd desktop

~/desktop $ javac CreeperTest.java

~/desktop $ java CreeperTest

Exception in thread “main” java.lang.UnsupportedClassVersionError: CreeperTest : Unsupported major.minor version 52.0

    at java.lang.ClassLoader.defineClass1(Native Method)
    
    at java.lang.ClassLoader.defineClass(Unknown Source)
    
    at java.security.SecureClassLoader.defineClass(Unknown Source)
   
    at java.net.URLClassLoader.defineClass(Unknown Source)
   
    at java.net.URLClassLoader.access$100(Unknown Source)

    at java.net.URLClassLoader$1.run(Unknown Source)

    at java.net.URLClassLoader$1.run(Unknown Source)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

~/desktop $

Generic-user-small
06 Jul 2014, 00:16
Noah David (4 posts)

i figured it out the. i had gotten the error because my java and javac version were not the same even though i had installed the most updated version, but for some reason my computer was using a older version of java so i uninstalled the older versions and then when i tried it it worked.

Andy-talking_pragsmall
07 Jul 2014, 18:17
Andrew Hunt (226 posts)

Ouch! That’s a rough one. There is a warning in the book about that, right at the top of page 19:

You might also want to check that your java is indeed the same version as your javac (it should be, but things happen):

So yes, apparently things can happen ;)

/\ndy

Generic-user-small
13 Feb 2015, 20:58
Kevin Nivek (4 posts)

Sorry to bump this thread, but I cannot get javac to work at all! :/ I’ve downloaded it, but this is what happens:

~/Desktop $ java -version

Error: could not open `C:\Users\Kevin\Desktop\lib\amd64\jvm.cfg’

~/Desktop $ javac -version

c:\users\kevin\desktop\sh: javac: not found

~/Desktop $

Any help?

Andy-talking_pragsmall
16 Feb 2015, 01:10
Andrew Hunt (226 posts)

Sounds like a corrupted install; see answer in the other thread. Search on stack Overflow for “java can’t open jvm.cfg” and you’ll see some answers.

/\ndy

Generic-user-small
09 Dec 2015, 23:56
Tom Jenkins (4 posts)

Hi Andy, We love your book. Trying to get past chapter 2. Java JDK downloaded onto Windows machine, into Program Files (x86) directory. Problem is, error message we get in command shell is “javac: not found.”

Eager to run CreeperTest.java. What can you suggest?

TJ

You must be logged in to comment