Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   The Lounge (http://www.alice.org/community/forumdisplay.php?f=4)
-   -   Compiling A .java File In To A .exe File (http://www.alice.org/community/showthread.php?t=9203)

David B 06-13-2012 03:51 PM

Compiling A .java File In To A .exe File
 
Hello Alice Community!

Today, I am starting my journey as I begin to learn Java, but I lack the basic knowledge of how I could compile a .java file into a .exe file that only needs the JRE ([U]J[/U]ava [U]R[/U]untime [U]E[/U]nvironment) to run.

MrMoke 06-19-2012 10:10 AM

Many solutions
 
You can use the command line to create the executable class files using javax, but it's easier on your brain to use one of the many IDE's that are available for free on the Internet.

Entry Level:
BlueJ
Greenfoot
JGrasp
JCreator

Professional:
Eclipse
NetBeans

Search Wikipedia for: Comparison of Integrated Development Environments
for links to many IDE's for Java. Each site should have downloads and tutorials.

x2495iiii 06-19-2012 10:23 PM

I'm using Eclipse and Netbeans.

:D

I feel professional!

sfunk 06-20-2012 12:06 AM

[QUOTE=x2495iiii;50206]I'm using Eclipse and Netbeans.

:D

I feel professional![/QUOTE]

Eclipse is really nice with it's colored syntax and short cuts, and it allows easy organization.

TauTrumpsPi 06-20-2012 07:33 AM

[QUOTE=sfunk;50207]Eclipse is really nice with it's colored syntax and short cuts, and it allows easy organization.[/QUOTE]

Yes, I use Eclipse too. It's very intuitive, easy to use while coding.

MrMoke 06-20-2012 08:20 AM

I Do Too
 
But,
The others, mostly developed by Computer Science Departments at Major Universities, aid the transition to Java by incorporating visual aids during execution and allowing novices to actually see the process. Web sites for the free products describe the visual aids.

As for you "Professionals"! That's Great! I've spent the last decade trying to make more of you, and send them to College.:o

x2495iiii 06-20-2012 03:27 PM

[QUOTE=MrMoke;50211]But,
The others, mostly developed by Computer Science Departments at Major Universities, aid the transition to Java by incorporating visual aids during execution and allowing novices to actually see the process. Web sites for the free products describe the visual aids.

As for you "Professionals"! That's Great! I've spent the last decade trying to make more of you, and send them to College.:o[/QUOTE]

Time well spent. Bravo, MrMoke.

And in hindsight, my grasp of NetBeans is tenuous at best. I used it to make some neat java-powered web pages, and that's about it.

David B 06-23-2012 10:56 PM

Okay. The Dummies Book says to use Eclipse, but since everyone is saying that it is more more professionals, and I am not a professional, should I actually use it, or should I do as the book says? I have already installed it on my computer.

sfunk 06-24-2012 12:00 AM

[QUOTE=MrMoke;50211]But,
As for you "Professionals"! That's Great! I've spent the last decade trying to make more of you, and send them to College.:o[/QUOTE]

I am definitely not a professional. I just like to dabble in anything that relates to computers. It will never be a career, more like a very fun and mind opening hobby. :D

arty-fishL 06-24-2012 08:49 PM

I find the best way to learn a new programming language is to dive right in. They are all basically more or less the same, so it is just a case of learning what is unique to that language.

Let Google be your friend and copy other people's work at first (innocently), start to modify it and soon you will get the hang of doing it yourself.

Eclipse really isn't that hard, in fact it is awesome because it is so good at realtime error checking and has a lot of cool features that make it much easier to code.

As a base to start with, I suggest creating a jar that you can run with a console, via a Batch file.

In Eclipse (presuming you know the basics of Java) create yourself a new workspace, add to it a new Java project.
Give the project a name and confirm it.
Create your package (by standard it is the reverse of your website plus the project name - ie com.google.project).
Create your main class, add the method:
[CODE]public static void main(String[] args) {
// start it here
}[/CODE]Add all the java/classes/packages etc that you want to.
Go to File>Export
Select JAR file.
Select the required resources.
Skip the next screen.
Select your main class.
Find where the jar file saved to.
Create a new text file in the same folder with this as its contents:
[URL="http://tinypaste.com/0cb52551"]Click here to view, I had to paste it externally as I get a 500 bad request error otherwise[/URL]
Replace "Title goes here" with your title, replace "Name_of_JAR" with the name of the jar and save.
Rename the text file to "RUN.bat".
Double click it and you will get a cmd window which can utilise System.out and System.in textually.

Sorry if that seems wrong to you, but I jut started properly learning Java yesterday.


All times are GMT -5. The time now is 03:56 AM.

Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.