Results 1 to 6 of 6
  1. #1
    SodamYat is offline Member
    Join Date
    Jul 2012
    Posts
    3
    Rep Power
    0

    Default Having trouble getting output with SciTE (totally new but not stupid!)

    I apologize for any rage I may induce in the frequenters of these forums on account of any improper formatting etc. I hope I've put this in an appropriate forum. I tried searching for someone with an identical problem but I didn't find any relevant topics in the relatively short time I looked. Eventually, I do hope to become better acquainted with these forums, and hopefully I will be able to use them as a valuable resource in learning Java.

    I've just recently installed java on this machine, but I'm having some trouble getting my first program (Hello, World!) to function. I'm using SciTE at the moment, and this is what the program looks like (the file is called HelloPrinter.java):

    public class HelloPrinter
    {
    public static void main(String[] args)
    {
    System.out.println("Hello, World!");
    }
    }
    (it's all properly indented but that doesn't show up here I guess)

    When I compile my output looks like this:

    >javac HelloPrinter.java
    >Exit code: 0

    Exit code: 0 indicates that everything went off without a hitch, but I don't see any Hello, World! message anywhere.

    Am I just missing a step? After compile should I be hitting run? I haven't got a run option, but I have a Go option. If I try "Go" I get this:

    >java -cp . HelloPrinter
    java.lang.UnsupportedClassVersionError: HelloPrinter : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknow n Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(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)
    Could not find the main class: HelloPrinter. Program will exit.
    Exception in thread "main" >Exit code: 1

    Environment Variables (bolded text is what I've altered since installing):
    JAVA_HOME: C:\JAVA\jdk1.7.0_05
    CLASSPATH: .;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip.;%JAVA_HOME%\lib\tools.jar
    Path: C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%Sy stemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Python27\.;%JAVA_HOME%\bin;


    A little background about me: I received an A in a 4-credit Python course, but I have no experience with Java. I had registered for a Java class last semester, but I had to drop it after a week due to a family emergency. I've still got my book ("Java For Everyone") and I'm trying to learn it now sans professor.
    Last edited by SodamYat; 07-08-2012 at 06:03 PM.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,528
    Blog Entries
    7
    Rep Power
    20

    Default Re: Having trouble getting output with SciTE (totally new but not stupid!)

    You're running an older java.exe version (probably version 1.6); that executable is stored in your /Windows/System32 directory; make your path point to the latest version in /Program Files/Java/jre7/bin before it finds the outdated version in that other direcrtory.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    SodamYat is offline Member
    Join Date
    Jul 2012
    Posts
    3
    Rep Power
    0

    Default Re: Having trouble getting output with SciTE (totally new but not stupid!)

    Thanks for the hasty reply! However, that's either not the issue, or more likely, I didn't resolve it correctly.

    My path variable now reads (bolded text being what I've changed):
    Path: C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Java\jre7\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\S ystem32\Wbem;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Python27\.;%JAVA_HOME %\bin;

    I also tried changing the java.exe file extension in system32 to .old (just to render it nonfunctional), but no dice.

    In command prompt if I enter java -version I get:
    java version "1.7.0_05"
    Java(TM) SE Runtime Environment <build 1.7.0_05-b05>
    Java HotSpot(TM) 64-Bit Server VM <build 23.1-b03, mixed mode>

    and if I type javac -version I get:
    javac 1.7.0_05

    It may also bear relevance that I am running Windows XP 64-Bit, and I have the 64-bit version of Java. I know that XP 64-bit doesn't always gel with all software, so if there are any known issues there please let me know.

    Thanks again for any and all help!

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,528
    Blog Entries
    7
    Rep Power
    20

    Default Re: Having trouble getting output with SciTE (totally new but not stupid!)

    So both your compiler and your jre itself report to be version 1.7; still when you try to run your class your jre reports that it doesn't support a version 1.7 (that's what the 51.0 is about) class. For some reason you're firing up an old(er) java.exe version. For a try: recompile your .java file and use the absolute path name for your javac.exe compiler; next do the same when you try to run the .class file. You do seem to have the correct versions of both your compiler and java virtual machine, but for some reason you're firing up a wrong (older) verson for the java virtual machine ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    SodamYat is offline Member
    Join Date
    Jul 2012
    Posts
    3
    Rep Power
    0

    Default Re: Having trouble getting output with SciTE (totally new but not stupid!)

    Aha! I've resolved the issue, and of course you were right. I'm still not terribly sure why it was referencing the older version, but it's gone now so the problem is resolved.

    Thanks a lot,

    Chris

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,528
    Blog Entries
    7
    Rep Power
    20

    Default Re: Having trouble getting output with SciTE (totally new but not stupid!)

    Quote Originally Posted by SodamYat View Post
    Aha! I've resolved the issue, and of course you were right. I'm still not terribly sure why it was referencing the older version, but it's gone now so the problem is resolved.
    Glad to read that you solved your problem; but now I'm curious: what did you do to make the problem go away?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Stupid Array are Stupid.
    By Army in forum New To Java
    Replies: 10
    Last Post: 04-13-2012, 06:51 PM
  2. 100% totally new to Java...
    By AzureKitsune in forum New To Java
    Replies: 20
    Last Post: 04-05-2012, 07:49 AM
  3. totally beginner
    By chipp in forum New To Java
    Replies: 19
    Last Post: 07-22-2011, 02:17 PM
  4. Having trouble looping & printing output
    By carrotcake in forum New To Java
    Replies: 1
    Last Post: 04-04-2010, 05:37 AM
  5. SciTE-debug 0.9.1
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 04-10-2008, 04:14 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •