Solved

java import class file

Posted on 2009-04-03
5
809 Views
Last Modified: 2012-05-06
Hi as per my previous question i am new to java . (1) i have a java app [ getnewkey.jar] , this app request user to input a key [eg AUIL01-1] . (2) i have a java class [key.class ]this generates a new key based on the last key. (3) i Want the java app to call the java class file once the user enters the key in the java app . The java class generates a new key i want to return this to the java app and display ( eg: 'New Key ... BUOPQ
0
Comment
Question by:skywaker
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:basav_com
ID: 24063541
declare the main class in the MANIFEST file of the .jar file and call the required classes from the main.
0
 

Author Comment

by:skywaker
ID: 24063572
how do i do this i am useing netbeans
0
 

Author Comment

by:skywaker
ID: 24063579
ps the class file is compiled i need to pass the variable key to this file and this would return a new key
0
 
LVL 12

Expert Comment

by:basav_com
ID: 24063636
Check this for how to create the .jar file Netbeans.
http://www.fsl.cs.sunysb.edu/~dquigley/cse219/index.php?it=netbeans&tt=jar&pf=y
0
 
LVL 12

Accepted Solution

by:
basav_com earned 500 total points
ID: 24063728
(1) i have a java app [ getnewkey.jar] , this app request user to input a key [eg AUIL01-1]    ---->  Consider you have the class 'MainFile.java', declare this 'MainFile' in the MANIFEST file. So watever you give to the .jar file will goto the main method of this class in the args[].

(2) i have a java class [key.class ]this generates a new key based on the last key.   ---> Declare one public method (say generateKey) which takes the input key and returns a new output key as type String.

 (3) i Want the java app to call the java class file once the user enters the key in the java app . The java class generates a new key i want to return this to the java app and display ( eg: 'New Key ... BUOPQ   ----> Now from the MainFile.java main method, instantiate this key.class and call the generateKey method.

Eg. public class MainFile{
  public static void main(String args[]){
    String inputKey = args[0];
     key mykey = new key();
    String outputKey = mykey.generateKey(inputKey);
System.out.println(outputKey);
   
 }

}
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now