Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Wednesday, 20 August 2014

Jdev JAVA_HOME

JDeveloper Set Java

It is quite easy to change the java used by jdev, all you need to do is find the jdev.conf file and change the line that has SetJavaHome in it.

This should be at the top of the file somewhere.

My config file is located at: /home/f/Oracle/Middleware11117/jdeveloper/jdev/bin

SetJavaHome /usr/lib/jvm/java-1.7.0-openjdk-amd64

#bearMan

Wednesday, 27 November 2013

Java - Create JAR within Terminal

Java - Create JAR within Terminal

So Myself and Kevin created a class file today and we wanted to create a Jar file using Terminal.

What we did to do this, is we used Terminal.

The short: If you want to create a Jar File:
jar cfe Main.jar Main Main.class

c: create File
f: File
e: Entry Point: The main method

The Format is
jar cfe <Jar File to create> <Class with main method> <classes to include>
You can also use
jar cfe Main.jar Main *.class


So what we initially did was we created the jar file with the "Default Manifest File" which looked like :
Manifest-Version: 1.0
Created-By: 1.7.0_25 (Oracle Corporation)

As you can see this is missing the Main-Class pointer.

So then we did some more research and found we needed to include the Entry Point, our main method.

Manifest-Version: 1.0
Created-By: 1.7.0_25 (Oracle Corporation)
Main-Class: Main

Our Java code looked like:

public class Main{

 public Main(){
  System.out.println("Main");
 }
public static void main(String[] args){
  System.out.println("Main method");
  new Main();
 }


#bearMan and theStroud

Monday, 25 November 2013

Java - Compile Through Command Line

Java - Compile Through Command Line

Initially set your path with the syntax

set path=%path%;<path to java>

Mine was:
set path=%path%;"C:\Program Files\Java\jdk1.7.0_25\bin\"

then to compile the .java to a .class, you need to use javac

run:

javac <Java File>

Mine was:
javac SSLSocketClient.java

To Run the Application using terminal, use java (Leave out the .class in the file name)
java SSLSocketClient

Thanks to Kevin for helping me.

#bearMan