Jump to content

So I have a computer science class that we learn java in, but we use JCreator which is no longer available for download. When we make files in JCreator, we just right click, new, file, [name].java and start the program from complete scratch, and it runs just fine in JCreator, why can't I do that in Eclipse? I want to be able to just make a .java file from scratch and run it without making a whole Project file in my eclipse workspace, but when I try to do that, it brings up a window titled: Select what to run, and it shows me 2 options, Ant Build, and Ant Build with 3 dots at the end, either one I click I get an error saying: Error: Build Failed, Reason: unable to find an Ant Run File.

 

Is there any IDEs that will allow me to just make my own .JAVA files and not a whole project, or can I change my eclipse to allow me to just make my own .JAVA files?

Link to comment
https://linustechtips.com/topic/971775-why-cant-i-run-a-java-file/
Share on other sites

Link to post
Share on other sites

Why don't you want to put it in a project? It's much cleaner that way.

Ryzen 5 1600 @ 3.9 Ghz  | Gigabyte AB350M Gaming 3 |  PaliT GTX 1050Ti  |  8gb Kingston HyperX Fury @ 2933 Mhz  |  Corsair CX550m  |  1 TB WD Blue HDD


Inside some old case I found lying around.

 

Link to post
Share on other sites

3 minutes ago, bleedblue said:

Why don't you want to put it in a project? It's much cleaner that way.

Because I just want to make small files for testing out, that I will be deleting very often, and I'm not used to the whole project file thing it's weird, is there a way to disable it?

Link to post
Share on other sites

Just now, DirtyKeyboard said:

Because I just want to make small files for testing out, that I will be deleting very often, and I'm not used to the whole project file thing it's weird, is there a way to disable it?

Nope, unless you want to compile and run using command line. Just create an eclipse project called "Test". 

Ryzen 5 1600 @ 3.9 Ghz  | Gigabyte AB350M Gaming 3 |  PaliT GTX 1050Ti  |  8gb Kingston HyperX Fury @ 2933 Mhz  |  Corsair CX550m  |  1 TB WD Blue HDD


Inside some old case I found lying around.

 

Link to post
Share on other sites

4 minutes ago, DirtyKeyboard said:

But how come you can do it in JCreator?

I've never used JCreator in all my time spent as a Java dev. I asked around my team and no one else has used it either lol.

 

Ryzen 5 1600 @ 3.9 Ghz  | Gigabyte AB350M Gaming 3 |  PaliT GTX 1050Ti  |  8gb Kingston HyperX Fury @ 2933 Mhz  |  Corsair CX550m  |  1 TB WD Blue HDD


Inside some old case I found lying around.

 

Link to post
Share on other sites

8 hours ago, bleedblue said:

I've never used JCreator in all my time spent as a Java dev. I asked around my team and no one else has used it either lol.

 

It’s probably because it uses a super old version of java and hasn’t updated

 

Link to post
Share on other sites

10 hours ago, DirtyKeyboard said:

So I have a computer science class that we learn java in, but we use JCreator which is no longer available for download. When we make files in JCreator, we just right click, new, file, [name].java and start the program from complete scratch, and it runs just fine in JCreator, why can't I do that in Eclipse? I want to be able to just make a .java file from scratch and run it without making a whole Project file in my eclipse workspace, but when I try to do that, it brings up a window titled: Select what to run, and it shows me 2 options, Ant Build, and Ant Build with 3 dots at the end, either one I click I get an error saying: Error: Build Failed, Reason: unable to find an Ant Run File.

 

Is there any IDEs that will allow me to just make my own .JAVA files and not a whole project, or can I change my eclipse to allow me to just make my own .JAVA files?

 

.java files are Java class files that haven't been compiled. If you want to be able to run a Java program, you're going to have to compile at least one class file into a .jar file.

 

In Eclipse, just make a project, (you don't have to do this, but it's a good idea) create a package, then create a class file (.java) inside of that package.

 

If you just want to test a single class file, you can do so within Eclipse.

Specs: CPU - Intel i7 8700K @ 5GHz | GPU - Gigabyte GTX 970 G1 Gaming | Motherboard - ASUS Strix Z370-G WIFI AC | RAM - XPG Gammix DDR4-3000MHz 32GB (2x16GB) | Main Drive - Samsung 850 Evo 500GB M.2 | Other Drives - 7TB/3 Drives | CPU Cooler - Corsair H100i Pro | Case - Fractal Design Define C Mini TG | Power Supply - EVGA G3 850W

Link to post
Share on other sites

1 hour ago, DirtyKeyboard said:

It’s probably because it uses a super old version of java and hasn’t updated

 

...then don't use it.

Ryzen 5 1600 @ 3.9 Ghz  | Gigabyte AB350M Gaming 3 |  PaliT GTX 1050Ti  |  8gb Kingston HyperX Fury @ 2933 Mhz  |  Corsair CX550m  |  1 TB WD Blue HDD


Inside some old case I found lying around.

 

Link to post
Share on other sites

On 14/09/2018 at 6:02 AM, DirtyKeyboard said:

So I have a computer science class that we learn java in, but we use JCreator which is no longer available for download. When we make files in JCreator, we just right click, new, file, [name].java and start the program from complete scratch, and it runs just fine in JCreator, why can't I do that in Eclipse? I want to be able to just make a .java file from scratch and run it without making a whole Project file in my eclipse workspace, but when I try to do that, it brings up a window titled: Select what to run, and it shows me 2 options, Ant Build, and Ant Build with 3 dots at the end, either one I click I get an error saying: Error: Build Failed, Reason: unable to find an Ant Run File.

 

Is there any IDEs that will allow me to just make my own .JAVA files and not a whole project, or can I change my eclipse to allow me to just make my own .JAVA files?

I mean, all that JCreator is presumably doing, is the following:

 

Assuming we have a class called HelloWorld (you can do this in any text editor, just need to name it {className}.java)

HelloWorld.java:
class HelloWorld{

        public static void main(String[] args){
                System.out.println("hello world");
        }
}

We compile it:

tom@TOMS-PC:~# javac HelloWorld.java

And run it

tom@TOMS-PC:~# java HelloWorld
hello world

 

Your IDE is basically doing nothing else.

 

Do you have this option in Eclipse when you right-click your main class (the .java file in the package explorer)?

image.png.c5b42d77c02789f6e11bed80d58e8f34.png

 

If not, go to the "run configuration" menu entry and then create a new run configuration -> java application -> select your main class -> accept -> run

 

Now you'll have this option to run as java application in the "run" menu. Or you can click the green "play" button in the action bar. Up to you, really.

 

AMD Ryzen 7800 X3D, MSI B650 Project Zero, Antec C5, Gigabyte RTX 4080 Super Aero

 

Nikon D500 | Nikon 300mm f/4 PF  | Nikon 200-500 f/5.6 | Nikon 50mm f/1.8 | Tamron 70-210 f/4 VCII | Sigma 10-20 f/3.5 | Nikon 17-55 f/2.8 | Tamron 90mm F2.8 SP Di VC USD Macro | Neewer 750II

Link to post
Share on other sites

6 hours ago, Fetzie said:

I mean, all that JCreator is presumably doing, is the following:

 

Assuming we have a class called HelloWorld (you can do this in any text editor, just need to name it {className}.java)


HelloWorld.java:
class HelloWorld{

        public static void main(String[] args){
                System.out.println("hello world");
        }
}

We compile it:


tom@TOMS-PC:~# javac HelloWorld.java

And run it


tom@TOMS-PC:~# java HelloWorld
hello world

 

Your IDE is basically doing nothing else.

 

Do you have this option in Eclipse when you right-click your main class (the .java file in the package explorer)?

image.png.c5b42d77c02789f6e11bed80d58e8f34.png

 

If not, go to the "run configuration" menu entry and then create a new run configuration -> java application -> select your main class -> accept -> run

 

Now you'll have this option to run as java application in the "run" menu. Or you can click the green "play" button in the action bar. Up to you, really.

 

Yeah, if you check the project folder in the ide, you can actually see a jar file which is built every time when you run the .java file

Sudo make me a sandwich 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×