Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7891365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:36:02+00:00 2026-06-03T06:36:02+00:00

I may have multiple questions here, but ultimately I’m trying to compile and run

  • 0

I may have multiple questions here, but ultimately I’m trying to compile and run a Java program that references 3rd party JAR files (on Ubuntu Linux) so I thought it was appropriate to keep it to one question.

I’m trying to get Java JDK 7 properly installed and configured to run a simple program on Ubuntu Linux. I’d like to get instructions from an expert that can help me, at the very least, to run a simple Java program from the command line (perhaps a “Hello World” application?). I’ve only compiled and run Java programs on Windows in the past, so this is new to me. Last night, I read that you have to be careful of not installing the Open JDK, and to install the Oracle JDK. It appears that Ubuntu 11.10 installs Java Open JDK for you when the OS is installed, among others.

I’m running 32-bit Ubuntu, not 64-bit. So I downloaded this Linux JDK file:
jdk-7u4-linux-i586.tar.gz

I unpacked the tarball into /usr/java and then deleted the *.gz file to save disk space. Some tutorials say to install into /usr/java and some say to install into /usr/lib/jvm, so I just picked one and rolled with it. If you have a suggestion on the appropriate install directory, please let me know what you suggest.

I then checked what Java version was installed (below) with the “java -version” command. It did not find the Oracle JDK.

(1) Why didn’t the command list the Oracle JDK package I just installed?

mac@UBUNTU:/usr/lib$ java -version
The program 'java' can be found in the following packages:
 * gcj-4.4-jre-headless
 * gcj-4.6-jre-headless
 * openjdk-6-jre-headless
 * gcj-4.5-jre-headless
 * openjdk-7-jre-headless
Try: sudo apt-get install <selected package>
mac@UBUNTU:/usr/lib$ 

(2) Can you help me with the steps necessary to configure this Linux machine to compile a Java program (finish what I just started)?

(3) Can you help me with the steps to compile a *.java file to create the *.class file?

(4) Can you help me run the Java program–the one we just compiled?

(5) Suppose I want to include multiple *.jar files (3rd party assemblies) in my Java program. How does Java know on Linux where to find these files if they are not in the directory running the Java program referencing them? (I’m only familiar with a CLASSPATH in Windows)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:36:04+00:00Added an answer on June 3, 2026 at 6:36 am
    1. Ubuntu is based on Debian and its apt-get utility. apt-get will list only known packages. The one you installed is just a folder lying on your system and apt-get does not even know about it.
    2. It looks like java is not on your path. So either you create a symbolic link to the java binary in one of the folders of your path (type env to see what’s in your path variable), or you add the JDK bin directory to your path (see command export). As a last resort, you can type the absolute path to the java binary, but that’s just painful.
    3. To compile, you simply use javac (Java compiler). For example javac Test.java. Make sure that javac is also on your path (or use the absolute path to the java compiler)
    4. To run it, type java -cp . Test (don’t forget to type the fully qualified name of your class if you put it inside a package, which is recommended)
    5. When you compile or when you run, use the argument -cp followed by the list of jars you want to use (separated by a ‘:’ on Linux and by a ‘;’ on Windows). You may use wildcards in your classpath (like lib/*.jar) but you may also have to escape the wildcard to avoid shell expansion (like this lib/\*.jar).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Objective: In support of a Windows Service that may have multiple instances on a
Let's say I have a program(C++, for example) that allocates multiple objects, never bigger
--EDIT-- I believe this is a valid question that may have multiple answers (as
This may not be explained the best but here it goes. I have a
A single interface may also have multiple IPv6 addresses of any type(unicast, anycast, and
Is it possible to calculate the mean of multiple arrays, when they may have
You may have heard of PawSense , a Windows-only utility that prevents keystrokes from
This question may have been asked before, but I had trouble finding an answer,
I am designing a Web application that we estimate may have about 1500 unique
We have a large high-performance software system which consists of multiple interacting Java processes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.