Question:
How can I compile and email Java programs to other people who don't have a compiler such as BlueJ?
2008-04-12 12:15:24 UTC
For a research project, I wrote a simple program in Java that measures the amount of time between a beep noise and when the user presses the Enter key. My plan is to send out this program to friends via email, but I'm not sure exactly how I could do this.

Originally, I planned to compile my code through BlueJ into an executable .jar file and tell people to launch it through the Command Prompt. This would normally work, but the beeping noise will not play through cmd. Is there any other way I can execute my program so that it will run normally with the beep (I'm using the AudioClip Applet). Thank you very much in advance!
Three answers:
Neeraj Yadav♄
2008-04-12 12:56:36 UTC
I guess the approach is just right..

as you said you want them to use your jar file.



Problem:

but how could you expect others to have those blueJ pluggins at thr side?



Solution:

You can send them the source piece of source code for the beeping applet and let them configure it by them.



Or they can directly decompile the .jar or .class file through

Decompiler n reuse it at their end.



free software called

Dj Decompiler

http://members.fortunecity.com/neshkov/dj.htm



hope this solves your issues

Cheers:)
2016-04-08 06:56:11 UTC
You need the Java runtime (JRE) to be installed on the computer, no matter what. That has just the files needed to run Java. You can test that in advance. Fire up the command prompt on the computer you want to use, and then enter: java -version If you get a response like: java version "1.7.0_21" Java(TM) SE Runtime Environment (build 1.7.0_21-b11) Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing) ...then you have Java installed and know the version. If you get a message like "'java' is not recognized as an internal or external command, operable program or batch file." then Java is either not installed or not installed properly. You don't need the Java Development Kit (JDK) and you don't need NetBeans, Eclipse or any other development tools. All you need is the class files, possibly packed into a JAR file. If you're just running from the command line, copy *.class from your working directory to the the USB drive. If you are compiling with NetBeans or Eclipse, either of those automatically pack everything the app needs into a JAR file. In NetBeans, it's stored in the "dist" subdirectory as "yourprojectname.jar". Just copy that to where you need it. With Eclipse, use the File>Export... and specify "Java>JAR File" in the window under "Export Destination" and click Next. Under "Export destination", click "Browse...", navigate to the folder where you want to put the JAR file, type a name with a .jar extension in the file name box (won't exist the first time), like "MyApp.jar" or something, and then click Finish. Since you have a console program, odds are that Windows is not set up to run a JAR or Java .class file with a console. You need to add one little bit to make it "clickable". A three line batch file, maybe named "MyApp.bat". Running from .class files, it will look like: @echo off java MyMainClass %* pause Running from a JAR file: @echo off java -jar MyApp.jar %* pause Now you should be able to just double-click on the batch file. The pause command will keep the screen from closing at the end of the run, prompting you to press a key first. Maybe your app doesn't need that, but it's a nice bit to have if you have an unexpected problem. You'll get to see and maybe copy/paste the exception message for debugging.
Blackcompe
2008-04-12 13:02:11 UTC
create a jar file. basically makes the file executable. their machines must have java



OR



create an applet and host it on a website


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...