java help:getting started

jasonz

New Member
can someone help me get started. Im trying to teach myself some java. I took the class in HS and remember some. Im using JCreator and i cant even get a simple println to work...

Code:
public class trial thingy {
    
    public static void main(String[] args) {
    	
    	// TODO, add your application code
    	System.out.println("Hello World!");
    }
}
error:
Error : Invalid path, \bin\javac.exe -classpath "C:\Program Files\Xinox Software\JCreatorV4LE\MyProjects\trial thingy\classes" -d C:\Program" Files\Xinox Software\JCreatorV4LE\MyProjects\trial "thingy\classes @src_trial_thingy.txt"


thanks, jason
 
You don't need Public class, just use class
Your class name can't have spaces in it
Change (String[] args) to (String args[]) - I got your way to work, but that's not default

I'm not sure if you used a program that "helped" you along, but I strongly suggest getting something else if that's the case :o

Code:
class helloWorld {
   public static void main(String[] args) {
      System.out.println("Hello World!");
   }
}
 
I never thanked you but when you posted about not finding JCreator a while back when I found it for you I started using it and got the rest of my class (All 3 or 4 of us :P) using it and it was pretty good So I'm thanking you now. :D

However I just upgraded to Netbeans which I love so you might want to try it out. :)

BTW The_Other_One nice Avatar change. :)
 
i dont think there is an error in the code. if i remember right, the [] can be either way. The error seems like i set up the file incorrectly, the location or destination or something.

j
 
jasonz - All the code I can find shows "String[]", but I'm no expert. It does, in fact work after args, but I don't think that's the standard... As for the location and all, I know that can be picky... However, I entered the code I posted using jGrasp and it worked just fine for me.

Netbeams is nice, but I learned on jGrasp. It's a bit more simplified and I find it easier to work with. NetBeans does too much for you...

BTW The_Other_One nice Avatar change. :)
I caught me a USB mouse x3 Haha, thank you! I'm half tempted to get one without my hands up. The artist who did these last couple mentioned doing that for me... At an avatar size, it might also help clarify what I'm actually holding :P
 
I can run it just fine by replacing the space with an _ (changing nothing else).
C:\Program" Files\Xinox Software\JCreatorV4LE\MyProjects\trial "thingy\classes @src_trial_thingy.txt"
That has to be the bad path it's talking about, I know what it's trying to do with the "s but it must not be working. Try putting the java file in a directory with no spaces.

There's an IDE called Gel, I used it all the time when I was doing Java, it's very good and free. http://www.gexperts.com/
 
Netbeams is nice, but I learned on jGrasp. It's a bit more simplified and I find it easier to work with. NetBeans does too much for you...

Yes it is a bit much for basic labs and such since it always wants you to make a project. :P

And cool the first Java IDE that I really used was jGrasp. :D (Mind you that was two IDE's ago though. :D)


I caught me a USB mouse x3 Haha, thank you! I'm half tempted to get one without my hands up. The artist who did these last couple mentioned doing that for me... At an avatar size, it might also help clarify what I'm actually holding :P

Thank you, I was wondering what is was exactly. :D
 
this doesnt work either in netbeans, using the template from the program and only adding a println.

Code:
public class HelloWorldApp {
    
    /** Creates a new instance of HelloWorldApp */
    public HelloWorldApp() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(StriSng[] args) {
        System.out.println("Hello World!");
    }
    
}

error this time is:
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\Jason Zidek\Hello World App\build\classes
C:\Documents and Settings\Jason Zidek\Hello World App\src\helloworldapp\HelloWorldApp.java:25: cannot find symbol
symbol : class StriSng
location: class helloworldapp.HelloWorldApp
public static void main(StriSng[] args) {
1 error
BUILD FAILED (total time: 0 seconds)
 
wow, after noticing that i just saw that String in StriSng[] args was spelt wrong. I dont think i did that..??? It works now as far as that problem. Still cant get it to work in JCreator which kinda pisses me off, but whatever.

Thanks for the help.
 
The problem in netbeans must be the spaces in the path name, if you try to create a java file on the root of your drive, like say 'C:\HelloWorldApp.java' it should work fine. There might be some config option in netbeans to make it handle spaces in the path name correctly.
 
Back
Top