TRENDING NEWS

POPULAR NEWS

Do We Need To Install Java In Every Pc Before Running A Compiled Java Application

Why Do I need to install Java to run an application written in Java but no other programming language (at least that I know of) has that requirement?

Well, two points:You don't necessarily have to install Java to run Java applications, you can do 'native packaging' which basically bundles a JVM with your app, and increases it's size by about 70MB, as of Java 8. With Java 9, that should get smaller, but considering my XCode install is 10GB, I'm not going to worry about 70MB.Most other languages are the same as Java, say Python, Ruby, PHP, Perl, JavaScript also have a runtime requirement. Swift does too, and when you bundle up a Swift Mac app, XCode throws in a Swift runtime for you, but not all the surrounding libraries, so it ends up quite a bit smaller than a JVM.So basically, you don't have to install Java necessarily, and loads of other languages have the same requirements.

Can Java run on any machine? What is needed to run Java on a computer?

There are 2 parts to java - the development environment (JDK) and the runtime environment (JRE). If you just want to run programs written in Java, then you download the JRE for your hardware/OS combination from java.sun.com.

if you also want to do development, then you also download the JDK. Java has been ported to many environments - just look for the one that matches what you are running.

Why JAVA is called as a platform independent programming language?

JAVA is called as a platform independent programming language as it works on the principle "compile once, run everywhere".

If you have written some code in JAVA and you have compiled that, you can execute the same code on any platform, the only thing you need is to install corresponding JVM(Java virtual machine).

Do we have the compilers for C,C++ and Java in Ubuntu by default?

Ubuntu ships with GCC, the GNU C compiler, python3, Bourne Shell (sh), Bourne again shell (bash), and a few other tools. Sometimes even g++ (c++ compiler) occasionally, but that is not the case with every installation.But you can install them easily with an internet enabled pc. Simply type these commands into the shell. sudo apt-get install g++
You'll be prompted to enter your account password. And then it builds the dependency tree, and if they are met, it installs g++ on your PC from one of the servers that hosts the program/application.As for Java, I don't know of any Linux distribution that ships with the JDK. Also you have many options for Java. You can install one of jdk, openjdk or gcj.jdk  and openjdk are both supplied by Oracle, the developer of the Java Platform, so I'd recommend installing either.Don't go for gcj, it's horrible.Also, try to download Java SE from Oracle's sites and follow the instructions as the dependencies may be hard to resolve with direct installation.

What do I need to run Java in my laptop?

This has two parts. First, you will step through the process of installing the software necessary to write, compile, and run Java programs. Second, you will step through the process of writing, compiling, and running a Java program.Downloading JavaGo to Java JDK, choose a JDK Version and download, and then choose "Windows Offline Installation, Multi-Language." If you have a 64-bit computer, you need to choose "Windows x64 executable."Installing JavaDouble-click on the downloaded file and proceed to install the software. Make note of where the software is installed.Set your "Environment Variables." This is the hardest part. Right-click on "My Computer" and choose "System Properties." Then click on the "Advanced" tab. Then press the "Environment Variables" button. There are two variables you need to add. First, in the "System variables" section, scroll down and find the variable named "Path." Click on it and then press the button "Edit". You put the path of where the jdk was installed to the end of the path.For example, I had to add: "C:\Program Files\Java\jdk1.7.0_08\bin" - make sure you are just adding it, not erasing what was already there.Now, look at the "User variables" section. If there is a Path variable, add the same thing to path. Otherwise, click the "New" button. Name the new variable "Path" and put in the same thing without the first semi-colon. Finally, click "OK" and exit the "System Properties" window.Writing, Compiling, and Running a Java ProgramWriting a program1. Make a directory for your java file2. Open notepad.3. write the code4. Save the file with the name "filename.java" into directory.Compiling a program on a PC1. Open a command prompt by clicking on start and then the "Run" button2. Type "cmd" into the dialog box and click "OK"3. Figure out the path for your new directory. When looking at a finder window, it is the field labeled "address" near the top of the window.4. Type "cd path." For example, I would type "cd (Path to my directory)"5. Type "dir" and verify that the file you created, filename.java, is in the directory.6. Now compile the program by typing "javac filename.java". If it says nothing, then it compiled successfully.Running a programType "java filename"Happy Coding :)

Java failed to intialize VM?

I'm trying to run my HelloWorldApp program with jdk 6 but each time i run i keep getting the error message: "Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object" I've tried using the cmd prompt to do it and I've recently switched to JCreator because it is a really great compiling and developing program but its still not working(same message) my script is:

/**
* @(#)listfiles.java
*
* listfiles application
*
* @author
* @version 1.00 2011/3/25
*/

public class listfiles {

public static void main(String[] args) {

java.io.File
System.out.println("Hello World!");
}
public class ListFiles {

public static void main(String[] args) {

java.io.File listroot = new java.io.File("c:/");
java.io.File[] files = listroot.listFiles();

System.out.println("Print root files from c:");

for (java.io.File file : files) {
if (file.isDirectory())
continue;
System.out.println(file.getPath());
}
}
}
}

This is what JCreator told me to do for my first app and I really want to get this working so I can start programming with java.

Thanx in advance, Nighthawk0973

My compiler in Textpad wont work.?

How to Use with the Java Development Kit
--------------------------------------...
The Java SDK is a product from Sun Microsystems for developing Java applications. It can be downloaded from http://java.sun.com/. We do not support it in any way (except for the interface with TextPad, described below), so please check that web page for support information.

Very Important:
-----------------------
To be able to use it with TextPad, the Java SDK must be installed using its setup program. This writes information to the registry, which TextPad cannot work without.

After you have installed the Java SDK, as described in its installation instructions, you can add commands to compile and run Java applications and applets to TextPad's Tools menu as follows:

1. From the Configure menu, choose Preferences.
2. Select the Tools page on the Preferences dialog box.
3. Click Add.
4. Select "Java SDK Commands" from the drop down menu.
5. Click OK.

You can assign shortcuts to any of these commands using the Keyboard page on the Preferences dialog box.

Notes:
----------
The option to add Java SDK commands only appears on that menu, if none of your tools runs JAVAC.EXE, JAVA.EXE or APPLETVIEWER.EXE.
The Java SDK commands are automatically added to the Tools menu, if the Java SDK is installed before TextPad is first run on a PC.
Do not attempt to capture the output of a Java application which reads from standard input. The Command Results window is output only, so you will not be able to type responses into it.

TRENDING NEWS