Want help to create jar file
Hi....
To Run my project user should install some software�s.. so I want to create a JAR file
Using that user can install my software�s.
I have created a JAR file using � jar cvfm Test. jar manifest.mf gsv48w32.exe jdk-1_5_0_06-windows-i586-p.exe � it is working fine. Only when those two .exe file are in the directory where my jar file is executing
But I want to give only Test.jar to users I don�t want to give gsv48w32,Jdk 1.5.
Is there any way to create a jar file.
Thanks
Graj
i am sending the code i used
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Container;
public class DefaultSample {
public static void main(String args[]) {
JFrame frame = new JFrame("Default Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
if(actionEvent.getActionCommand()=="press this button if u want to install Gsview")
try{
Runtime.getRuntime().exec("gsv48w32.exe");
catch(Exception e)
else
try{
Runtime.getRuntime().exec("jdk-1_5_0_06-windows-i586-p.exe");
catch(Exception e)
JPanel panel = new JPanel();
JButton defaultButton = new JButton("press this button if u want to install Gsview");
defaultButton.addActionListener(actionListener);
panel.add(defaultButton);
JButton otherButton = new JButton("press this button if u want to install java 1.5");
otherButton.addActionListener(actionListener);
panel.add(otherButton);
Container contentPane = frame.getContentPane();
contentPane.add(panel);
frame.getRootPane().setDefaultButton(defaultButton);
frame.setSize(700,600);
panel.setVisible(true);
frame.setVisible(true);
}
Similar Messages
-
Help with creating jar file and running it ?
Hey guys,
I have a program with a package called classes and a sub-package called classes.mainLib.
I am trying to create a JAR file of the class files in mainLib. There is only one class file in classes and that contains the main method. So this is what i am doing:
1. create a manifest file with: Main-Class: classes.Cars
2. from within the mainLib directory (./program_name/classes/mainLib/) i do this:
jar cvf mainLib.jar manifest ./*.class
3. Then i move this jar file to ./program_name/lib and change directory to ./program name/
4. try to do this: java -jar ./lib/mainLib.jar
But it errors with:
gary@linuxbox:~/java/cars$ java -jar ./lib/mainLib.jar
Failed to load Main-Class manifest attribute from
./lib/mainLib.jar
Any ideas why this is happening. the manifest is included in the jar'ing
Thanks.At a glance, it looks like you are placing only the
class files in the jar and trying to navigate your
classpath to run it. Instead, you have to place ALL
the package folders into the jar from the root of
your package hierarchy and the jar runs anywhere, in
any folder. The packages are INSIDE the jar.
also I see cars/classes in a path you describe ...and
the program seems to wnat classes/Cars ??? Could
this be an additional issue (or am I missing seeing
something about your package structure)?Firstly, i believe all my spelling and cases are correct.
I have the following strcuture:
Cars.class (contains main) : package classes in ./classes directory
All other classes : package classes.mainLib in ./classes/mainLib
I would like to jar ALL files in mainLib but not the class that contains the main method. Is this possible?
I'm not sure how clear i was earlier, hope this is more understandable. -
hi,
i have developed a application with swing concept and mysql as my database... now i am trying to create jar file for my application... in the manifest file i have given like this:
class-path: C:\Program Files\MySQL\mysql-connector-java-5.0.4-bin.jar;C:\Program Files\Java\jdk1.5.0\bin;
Main-Class: Login
but still it throws an exception that main class: could not be found:
can any one help me...
Thank u in advance..
AbdulFor a classpath it is easy to forget to add code]//.;[ to the classpath and you also want to add %CLASSPATH%; as well
example classpath=.;%CLASSPATH%;...........rest of libs/jars the dot tells jvm to search current directory just like in DOS
Sean -
Creating jar file including 2 another jar files
hi
My project has java files, properties files,batch files as well as two jar files,mail.jar & activation.jar(for importing packages).
I have to include these jar files while setting environment variables.
Now i want to make "MyPrj.jar" file for myproject ,can anyone pls help me how to include these all files into a single jar file. and how to make setup file
I have tried to extract out .class files of mail.jar & activation.jar & i ve created MyPrj.jar by including all class files(including class files of mail.jar & activation.jar) but manifest file(headers) are not added to MyPrj.jar.
i have also tried to give mail.jar & activation.jar in Class-Path of menifest file, but it is also not working.
Pls Help
Thanks a lot[http://sourceforge.net/projects/one-jar]
"One-JAR(TM) is a simple solution to a vexing problem in Java: how to distribute an application as a single jar-file, when it depends on multiple other jar-files. One-JAR uses a custom classloader to discover library jar files inside the main jar. " -
How should I create JAR file which contain JMF library and project classes
Hi,
I installed the JMF windows pack. I compiled and ran successfully myApplet (which use JMF librarie) in Internet Explorer on my machine. When I run this applet on some different machine, where JMF isn�t installed- it�s not running.
There is an error:
java.lang.NoClassDefFoundError: javax/media/ControllerListener
I was trying to create jar file, which contain librarie JMF.jar and all other files which are require to run myApplet (*.jar, *.class, the files from folder �MyApplet�) and run it on the other computer. It still doesn�t work.
Also I ran a JMF Customizer and created customize.jar but this file contains only JMF classes. I don�t know how add other files to it.
How should I create a jar file which will contains all essential files to run myApplet on other machine (something like �All In One� J )
I�m using Eclipse.
Can somebody help me?.
Thank You!
Best regards:
PeterHi
i want to make a jar file of application which is using JMF to play audio
and video. it works well during compilation and execution but doesn't
works in jar file.
please help me how i make a jar file whic will run audio and video too
your's truely
abdul -
Problem while creating JAR file for my swing application
Hi...
Using my swings application I am trying to Run different software�s .
My program is Running fine from command prompt. If I create JAR file
It is giving error like �Failed to load Main-Class manifest attribute from .jar�
Can anybody help me to creating JAR file
Thanks in advance
Cheers
Mallikhi,
User following command
jar-cmf textfile_name.txt Jarfile_name *
here you have to make manifest file
and making jar file you have reach there by command promt
and manifest file have some constraint also as well as format
format are
Manifest-Version: 1.0
Class-path: jar file name which are using in app separed by space
Created-By: 1.5.0 (Sun Microsystems Inc.)
Main-Class: Main class name
and end of file is not have carriage return -
How can i create Jar file using Eclipse IDE.
Hi Guys
Am new to java. I want convert my project into executable jar file.
In my project am using itext.jar.And some other folder.
already i create jar file.But its not working.only its working 4 modules after that its say file cannot found exception.but the file path is correct.i dont know why its happen.
This is my project folder strutre also
Log:->
src(folder)
logs(folder)
comments(folder)
lib-->itext.jar.
images-->1,gif
properties-->catconfig.properties (file)
now can i create jar file
this code also show error when i run the jar file
And this is my catconfig. properties file
fileName=total_system_log.log
DDSingle=DD_bysingleIP_comment.txt
DDRange=DD_byrange_comment.txt
NDPing=ping_comments.txt
NDFPing=fping_comments.txt
reportFileName=report.txt
moduleFileName=Modules.txt
propFileName=nameDetails.properties
Choice=DDSingle
logFileName=DDSingleIP_10.32.0.2.log
finalReport=FinalReport.txt
logFilePath=\logs\
commentFilePath=\\Comments\\
its very urgent for me . could u pls send my error and u r ideas.
thanks for u r Ansewering.
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.ArrayList;
public class LogReader {
public void getValuesFromFilesOnly(String Choice,String logFileName)
try {
ArrayList commentsList = new ArrayList();
ArrayList tempList = new ArrayList();
String userdir = System.getProperty("user.dir");
String logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
String commentDir =ResourceBundle.getBundle("catconfig").getString(Choice);
String commentFilePath=ResourceBundle.getBundle("catconfig").getString("commentFilePath");
String currentdir1 =userdir+logFilePath+logFileName;
StringBuffer strBuff=new StringBuffer();
RandomAccessFile randomFile = null;
RandomAccessFile commentsFile = null;
String tempLine = null;
String commentLine = null;
String catVersion = null;
String finalReport=null;
int colon = 0;
int counter = 0;
boolean startFlag = false;
boolean endFlag = false;
boolean endOfFileFlag = false;
System.out.println("Log file checked----->"+currentdir1);
System.out.println("comments file used--->"+commentDir);
try {
randomFile = new RandomAccessFile(currentdir1, "r");
} catch (Exception e) {
System.out.println("exception@getValuesFromFilesOnly@begin : "+e);
System.out.println("hi test1");
String commentDir1=userdir+commentFilePath+commentDir;
try{
System.out.println("Comment Dir:"+commentDir1);
commentsFile = new RandomAccessFile(commentDir1, "r");
catch (Exception e) {
System.out.println("exception@getValuesFromCommentDirOnly@begin : "+e);
while ((commentLine = commentsFile.readLine()) != null) {
String checkLine = commentLine.substring(commentLine.indexOf("=")+1, commentLine.length());
String message = commentLine.substring(0,commentLine.indexOf("="));
commentsList.add(checkLine);
commentsFile.close();
String startComment = (String)commentsList.get(0);
String endComment = (String)commentsList.get(commentsList.size()-1);
strBuff.append(" CAT LOG REPORT \n\n");
while ((tempLine = randomFile.readLine()) != null) {
if(tempLine.contains("CAT version is :"))
colon = tempLine.indexOf("is :");
catVersion = tempLine.substring(colon+4,tempLine.length());
String version=tempLine;
strBuff.append("Version : "+catVersion+"\n");
System.out.println("catVersion is :"+catVersion);
commentsFile = new RandomAccessFile(commentDir1, "r");
while ((commentLine = commentsFile.readLine()) != null) {
String checkLine = commentLine.substring(commentLine.indexOf("=")+1, commentLine.length());
String message = commentLine.substring(0,commentLine.indexOf("="));
checkLine=checkLine.toLowerCase();
tempLine=tempLine.toLowerCase();
if(tempLine.contains(checkLine))
colon = tempLine.indexOf("info -");
catVersion = tempLine.substring(colon+7,tempLine.length());
strBuff.append(message+" ==> "+catVersion+"\n");
System.out.println(message+" ==> "+catVersion);
tempList.add(message+" ==> "+catVersion);
if (catVersion.contains(startComment)){
startFlag = true;
counter++;
System.out.println("*******startFlag**********"+startFlag);
if (catVersion.contains(endComment)){
endFlag = true;
System.out.println("*******endFlag**********"+endFlag);
if (startFlag == true && endFlag == true){
System.out.println("******************************************");
System.out.println("-------------Successfull completion-------");
System.out.println("******************************************");
startFlag = false;
endFlag = false;
counter = 0;
tempList.clear();
if (startFlag == true && endFlag == false && counter > 1){
System.out.println("******************************************");
System.out.println("---------------Failure after-----:"+tempList.get(tempList.size()-1));
System.out.println("******************************************");
//startFlag = false;
//endFlag = false;
counter = 0;
tempList.clear();
commentsFile.close();
endOfFileFlag = true;
if (startFlag == true && endFlag == false && endOfFileFlag == true){
System.out.println("******************************************");
System.out.println("---------------Failure after-----:"+tempList.get(tempList.size()-1));
System.out.println("******************************************");
startFlag = false;
endFlag = false;
counter = 0;
tempList.clear();
randomFile.close();
System.out.println("hi");
finalReport=ResourceBundle.getBundle("catconfig").getString("finalReport");
savereportFile(strBuff,finalReport);
System.out.println("Report Generated");
} catch (Exception e){
System.out.println("Exception@getValuesFromFilesOnly : "+e);
public void findDetails()
String currentdir1 = ResourceBundle.getBundle("catconfig").getString("fileName");
String logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
String userdir = System.getProperty("user.dir");
RandomAccessFile randomFile = null;
StringBuffer strBuff=new StringBuffer();
StringBuffer strBuff1=new StringBuffer();
StringBuffer strBuff2=new StringBuffer();
String tempLine = null;
String catVersion = null;
String timeStr=null;
String nameStr=null;
String startIP="";
String endIP="";
String tempStart="";
String tempEnd="";
String reportFileName="";
String moduleFileName="";
String propFileName="";
int startPos=0;
int endPos=0;
int fromIndex=0;
boolean versionFlag=false;
boolean ndFlag=false;
boolean ddFlag=false;
try {
randomFile = new RandomAccessFile(userdir+logFilePath+currentdir1, "r");
while ((tempLine = randomFile.readLine()) != null) {
if(tempLine.contains("CAT version is :") && !versionFlag)
startPos = tempLine.indexOf("is :");
catVersion = tempLine.substring(startPos+4,tempLine.length());
String version=tempLine;
strBuff.append("version : "+version+"\n");
versionFlag=true;
//System.out.println("version : "+version);
if(tempLine.contains("Inside NetworkDiscoverySlider.jsp"))
ndFlag=true;
strBuff.append("ND start : "+tempLine+"\n");
if(tempLine.contains("Inside NetworkDiscoveryDetails.jsp"))
strBuff.append("ND end : "+tempLine+"\n");
//System.out.println(" ND end : "+tempLine);
if(tempLine.contains("Given IPRange from"))
startPos = tempLine.indexOf("from");
catVersion = tempLine.substring(startPos+5,tempLine.length());
strBuff.append("NDRange : "+catVersion+"\n");
//strBuff.append("NDRange : "+tempLine+"\n");
//System.out.println("NDRange :"+catVersion);
startPos=0;
fromIndex=tempLine.indexOf(":");
endPos= tempLine.indexOf(':', fromIndex+2);
//System.out.println("fromIndex : "+fromIndex+" endPos : "+endPos);
timeStr=tempLine.substring(startPos, endPos);
nameStr=catVersion.replaceAll(" ", "_");
strBuff2.append("ND_"+timeStr+" "+catVersion+" = "+"NDRange_"+nameStr+".log\n");
if(tempLine.contains("inside ByIpAddress.jsp"))
ddFlag=true;
strBuff.append("DD Start : "+tempLine+"\n");
if(tempLine.contains("start_IpAddress:"))
startPos = tempLine.indexOf("start_IpAddress:");
catVersion = tempLine.substring(startPos+16,tempLine.length());
startIP=catVersion;
if(tempLine.contains("end_IpAddress"))
startPos = tempLine.indexOf("end_IpAddress");
catVersion = tempLine.substring(startPos+13,tempLine.length());
endIP=catVersion;
if(endIP.length()==0)
System.out.println("hi5");
strBuff.append("DDSingleIP : "+startIP+"\n");
//strBuff.append("DDSingleIP : "+tempLine+"\n");
//System.out.println("DDSingleIP : "+startIP);
//startPos = tempLine.indexOf(" ");
startPos=0;
fromIndex=tempLine.indexOf(":");
endPos= tempLine.indexOf(':', fromIndex+2);
timeStr=tempLine.substring(startPos, endPos);
strBuff2.append("DD_"+timeStr+" "+startIP+" = "+"DDSingleIP_"+startIP+".log\n");
else
strBuff.append("DDRangeIP : "+startIP + " to "+ endIP+"\n");
//strBuff.append("DDRangeIP : "+tempLine+"\n");
//System.out.println("DDRangeIP : "+startIP + " to "+ endIP);
//startPos = tempLine.indexOf(" ");
startPos=0;
fromIndex=tempLine.indexOf(":");
endPos= tempLine.indexOf(':', fromIndex+2);
timeStr=tempLine.substring(startPos, endPos);
strBuff2.append("DD_"+timeStr+" "+startIP+" to "+endIP+" = "+"DDRangeIP_"+startIP +"_to_"+ endIP+".log\n");
if(tempLine.contains("set percentage completedCount: 100"))
System.out.println("hi...1");
strBuff.append("DD End : "+tempLine+"\n");
//System.out.println("DD End : "+tempLine);
reportFileName=ResourceBundle.getBundle("catconfig").getString("reportFileName");
savereportFile(strBuff,reportFileName);
if(ndFlag)
strBuff1.append("Network Discovery\n");
if(ddFlag)
strBuff1.append("Device Discovery\n");
moduleFileName=ResourceBundle.getBundle("catconfig").getString("moduleFileName");
savereportFile(strBuff1,moduleFileName);
propFileName=ResourceBundle.getBundle("catconfig").getString("propFileName");
savereportFile(strBuff2,propFileName);
} catch (Exception e)
System.out.println("error hi1");
System.out.println("Exception@findDetails : "+e);
public void savereportFile(StringBuffer strBuff,String targetFileName)
try{
String userdir = System.getProperty("user.dir");
String logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
String reportFile=userdir+logFilePath+targetFileName;
String fileContent="";
fileContent=strBuff.toString();
//System.out.println("file content : "+fileContent);
FileWriter fileWriter = new FileWriter(reportFile);
if(fileContent!=null)
fileWriter.write(fileContent);
fileWriter.close();
catch(Exception e)
System.out.println("error hi1");
System.out.println("Exception@savereportFile : "+e);
public ArrayList<String> getFileNames()
String reportFile=ResourceBundle.getBundle("catconfig").getString("reportFileName");
String logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
String userdir = System.getProperty("user.dir");
RandomAccessFile repFile=null;
String reportLine = null;
int colon=0;
int fromIndex=0;
int startPos=0;
int endPos=0;
String timeStr="";
String fileName=null;
ArrayList<String> nameList=new ArrayList<String>();
try
reportFile=userdir+logFilePath+reportFile;
repFile = new RandomAccessFile(reportFile, "r");
while ((reportLine = repFile.readLine()) != null) {
if(reportLine.contains("NDRange"))
colon=reportLine.indexOf(" : ");
fileName=reportLine.substring(colon+3, reportLine.length());
fileName="NDRange_"+fileName.replaceAll(" ", "_");
nameList.add(fileName);
System.out.println("fileName : "+fileName);
if(reportLine.contains("DDSingleIP"))
colon=reportLine.indexOf(" : ");
fileName=reportLine.substring(colon+3, reportLine.length());
fileName="DDSingleIP_"+fileName.replaceAll(" ", "_");
nameList.add(fileName);
System.out.println("fileName : "+fileName);
if(reportLine.contains("DDRangeIP"))
colon=reportLine.indexOf(" : ");
fileName=reportLine.substring(colon+3, reportLine.length());
fileName="DDRangeIP_"+fileName.replaceAll(" ", "_");
nameList.add(fileName);
System.out.println("fileName : "+fileName);
repFile.close();
catch(Exception e)
System.out.println("Error@getFileNames : "+e);
return nameList;
public void writeFile(String oldLogName,String newLogName)
try
FileOutputStream writeFile=null;
String line = null;
String userdir = System.getProperty("user.dir");
String reportFile=ResourceBundle.getBundle("catconfig").getString("reportFileName");
String newLogPath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
RandomAccessFile repFile=null;
String reportLine = null;
String tempLine=null;
String prevLine=null;
String nextLine=null;
String target=null;
String tempStr=null;
String startStr=null;
String endStr=null;
int pos=0;
boolean flag=false;
boolean writeFlag=false;
boolean versionFlag=false;
//System.out.println("newLogName : "+newLogName);
newLogPath=userdir+newLogPath;
System.out.println("newLogPath : "+newLogPath);
BufferedReader buffRead = new BufferedReader(new FileReader(oldLogName));
writeFile = new FileOutputStream(newLogPath+newLogName+".log", false);//true-for append mode
DataOutputStream dout=new DataOutputStream(writeFile);
tempStr=newLogName.replace("_", " ");
pos=tempStr.indexOf(" ");
startStr=tempStr.substring(0,pos);
endStr=tempStr.substring(pos+1, tempStr.length());
target=startStr+" : "+endStr;
System.out.println("target ===> "+target);
reportFile=newLogPath+reportFile;
repFile = new RandomAccessFile(reportFile, "r");
while ((reportLine = repFile.readLine()) != null) {
if(reportLine.contains(target))
flag=true;
prevLine=tempLine;
//System.out.println("prevLine *****: "+prevLine);
else
tempLine=reportLine;
if(flag==true)
nextLine=reportLine;
flag=false;
//System.out.println("nextLine *******:"+nextLine);
break;
repFile.close();
if(prevLine!=null && prevLine.length()>0)
pos=prevLine.lastIndexOf(" : ");
prevLine=prevLine.substring(pos+3, prevLine.length());
//System.out.println("prevLine : "+prevLine);
else
System.out.println("Starting line not available for : "+target);
if(nextLine!=null && nextLine.length()>0)
pos=nextLine.lastIndexOf(" : ");
nextLine=nextLine.substring(pos+3, nextLine.length());
//System.out.println("nextLine : "+nextLine);
else
System.out.println("Ending line not available for : "+target);
nextLine=prevLine;
while ((line=buffRead.readLine()) != null) {
if(line.contains("CAT version is :") && !versionFlag)
versionFlag=true;
dout.writeBytes(line+"\n");
if(line.contains(prevLine))
writeFlag=true;
if(line.contains(nextLine))
writeFlag=false;
break;
if(writeFlag)
dout.writeBytes(line+"\n");
dout.writeBytes(nextLine+"\n");
buffRead.close();
System.out.println("done");
catch(Exception e)
System.out.println("Exception@writeFile : "+e.getMessage());
public String folderCheck(String foldName)
File folder=null;
File newFile=null;
String[] folderContent=null;
String tempFileName="";
String newLogName="";
int count=0;
String logFilePath="";
String fileName="";
String feedBackMsg="";
String userdir = System.getProperty("user.dir");
logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
fileName=ResourceBundle.getBundle("catconfig").getString("fileName");
folder=new File(foldName);
if(folder.isDirectory())
newLogName=userdir+logFilePath+fileName;
//System.out.println("newLogName : "+newLogName);
newFile=new File(newLogName);
if(newFile.exists())
newFile.delete();
folderContent= folder.list();
if (folderContent != null && folderContent.length>0)
System.out.println("folder has files : "+folderContent.length);
for(int iterate=0;iterate < folderContent.length;iterate++){
if (folderContent[iterate].toLowerCase().contains("system"))
count++;
tempFileName=foldName+"/"+folderContent[iterate];
try
FileOutputStream appendedFile=null;
BufferedReader buffRead = new BufferedReader(new FileReader(tempFileName));
appendedFile = new FileOutputStream(newLogName, true);//true-for append mode
DataOutputStream dout=new DataOutputStream(appendedFile);
String line = null;
System.out.println("writting : "+tempFileName);
while ((line=buffRead.readLine()) != null) {
dout.writeBytes(line+"\n");
buffRead.close();
//System.out.println("done");
catch(Exception e)
System.out.println("Exception@folderCheck : "+e);
if(count==0)
feedBackMsg="syslognotavail";
//System.out.println("System Log(s) not available");
else
feedBackMsg="syslogavail";
//System.out.println(count +" System log(s) avail");
else
feedBackMsg="filesnotavail";
//System.out.println("Files are not in the folder");
else
feedBackMsg="Dirnotavil";
//System.out.println("Directory not exists in the given name");
return feedBackMsg;
public ArrayList<String> loadFileContent(String selectedStr)
//System.out.println("inside loadFileContent()");
String logFilePath="";
String propFileName="";
String line="";
String choice="";
String tempStr="";
int startPos=0;
int endPos=0;
ArrayList<String> timeList=new ArrayList<String>();
String userdir = System.getProperty("user.dir");
try
logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
propFileName=ResourceBundle.getBundle("catconfig").getString("propFileName");
propFileName=userdir+logFilePath+propFileName;
BufferedReader buffRead = new BufferedReader(new FileReader(propFileName));
if(selectedStr.equalsIgnoreCase("Device Discovery"))
choice="DD";
else if(selectedStr.equalsIgnoreCase("Network Discovery"))
choice="ND";
while ((line=buffRead.readLine()) != null) {
if(line.contains(choice))
System.out.println(line);
startPos=line.indexOf("_");
endPos=line.indexOf(" =");
tempStr=line.substring(startPos+1, endPos);
System.out.println("tempStr : "+tempStr);
timeList.add(tempStr);
buffRead.close();
catch(Exception e)
System.out.println("Exception@loadFileContent : "+e);
return timeList;
public String getFileName(String timeStr)
System.out.println("inside getFileName");
String logFilePath="";
String propFileName="";
String line="";
String tempStr="";
int startPos=0;
String userdir = System.getProperty("user.dir");
try
logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
propFileName=ResourceBundle.getBundle("catconfig").getString("propFileName");
propFileName=userdir+logFilePath+propFileName;
BufferedReader buffRead = new BufferedReader(new FileReader(propFileName));
while ((line=buffRead.readLine()) != null) {
if(line.contains(timeStr))
System.out.println(line);
startPos=line.indexOf(" = ");
tempStr=line.substring(startPos+3, line.length());
System.out.println("tempStr : "+tempStr);
buffRead.close();
catch(Exception e)
System.out.println("Exception@loadFileContent : "+e);
return tempStr;
public ArrayList loadFile()
String logFilePath="";
String moduleFileName="";
String line="";
ArrayList<String> moduleList=new ArrayList<String>();
String userdir = System.getProperty("user.dir");
try
logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
moduleFileName=ResourceBundle.getBundle("catconfig").getString("moduleFileName");
moduleFileName=userdir+logFilePath+moduleFileName;
BufferedReader buffRead = new BufferedReader(new FileReader(moduleFileName));
while ((line=buffRead.readLine()) != null) {
moduleList.add(line);
buffRead.close();
catch(Exception e)
System.out.println("Exception@loadFile : "+e);
return moduleList;
public static void main(String[] args) {
System.out.println("Inside main");
//String userdir = System.getProperty("user.dir");
//System.out.println("userdir : "+userdir);
/*ArrayList<String> fileNameList=new ArrayList<String>();
String Choice="";
String logFileName="";
String logFilePath="";
String totalLog="";
String newLog="";
String folderName="";
Choice=ResourceBundle.getBundle("catconfig").getString("Choice");
logFileName=ResourceBundle.getBundle("catconfig").getString("logFileName");
logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
folderName=ResourceBundle.getBundle("catconfig").getString("folderName");
totalLog=ResourceBundle.getBundle("catconfig").getString("fileName"); */
/*try
//to write the total log
//folderCheck(folderName);
//to find the details in the given log
//findDetails();
//to split the logs accordingly
totalLog=logFilePath+totalLog;
fileNameList=getFileNames();;
System.out.println("FileNameList size = "+fileNameList.size());
for(int i=0;i<fileNameList.size();i++)
newLog=fileNameList.get(i).toString();
writeFile(totalLog,newLog);
//to analyse the logs & to produce reports
//getValuesFromFilesOnly(Choice,logFileName);
}catch (Exception e)
System.out.println(e.getMessage());
}[JSP is used for server validation.
So you need a an application server (like Tomcat or Jboss) to execute your jsp files.
you can create the .war file of your simple jsp application and put it in the server.
then you will have to access your page using a web browser.
the URL will be
http://<ComputerName or IP Address>:<PortNumber>/<WarFileName>/<MainJspPage>
(eg: http://100.100.100.252:8080/SimpleApplication/mainPage.jsp)
-Achyuth -
When re-installing JRE 1.2.2 I get an error "can't create JAR file"
When I uninstalled Java Runtime 1.2.2 and reinstalling, at the end of the installation I get an error:
"Error while creating JAR file.
Check you have enough disk space.
See c:\winnt\temp\uncrunch.log for details"
Only trouble is I've got 14 GB open and the uncrunch.log file isn't even created.
Any suggestions or help would be greatly appreciated!
JohanI am also getting a similar error with JRE 1.3.1
I actually get an uncrunch.log:
Running uncrunch
lpCmdLine = "C:\Program Files\JavaSoft\JRE\1.3.1\tmp\rt.out" "D:\\rt.jar"
Crunching from C:\Program Files\JavaSoft\JRE\1.3.1\tmp\rt.out to D:\\rt.jar
Temporary file = D:\\rt.tmp
Couldn't open output file "D:\\rt.tmp"
The only problem is that D: is a CD ROM drive. Don't know why it is trying to use D:
Any one have any ideas? -
How to create jar file in WSAD ide?
Hi,
Can any one help me in creating jar file
in WSAD ide?RTFM comes to mind, the manual often knows such things.
-
How to create jar files from my code?
Hi, I�m a rookie programmer and i need to create jar files in my application code. Which classes do i need to use?
Can anybody give me an example?
Thanx in advanceThanx Uwe. You�re right, i�m only trying to create jar
files (and extract files from a jar file) I will try
what you told me. Anyway, I have some doubts about how
to use those classes.Can you give me any example?
Thanx again!To create jar files use the class JarOutputStream.
Add a ZipEntry for each entry in the jar file.
To read jar files use the class JarInputStream and get all JarEntry.
It should be straight forward.
Uwe -
Creating JAR files programmatically
I am trying to create JAR files programmatically using the java.util.zip and java.util.jar APIs. I am starting with just a set of directories containing .class files. I can seem to make the JAR but if I try to use any of the classes in it they don't work. But, if I unzip the JAR using WinZip, the classes are usable. So I am somehow building the JAR file incorrectly. Does anyone have any ideas or suggestions? The code is pretty long so I won't post it yet but I can send it to you if you'd like to see it. Contact by email if you'd like to see the code. Thanks.
What paths are you encoding? Here are a couple of rules:
1 - All paths are '/' separated, and do not begin with a '/'.
2 - All paths are relative (see 1) and contain the exact package name of the class, plus the class.
E.G., the class java.lang.Object would look like this in your jar:
java/lang/Object.classNothing more or less. -
Jdeveloper 10.1.2 creating jar files in user's temporary director
Hi all,
McAfee uses 100% of my PC CPU every once in a while when jdevw.exe creates jar files in C:\Documents and Settings\wase\Local Settings\Temp. They get created at seemingly random times while I am running the embedded OC4J in debug mode (Struts, BC4J, ADF). McAfee is configured to ignore a few of my directories and I would like to direct those files into an unscanned directory. (No, The powers that be will NOT turn off on access scanning of archives. Sigh.) The files go away when I shut down JDeveloper.
Thanks,
--Amy Smith
Here is a list of the files that were created.
/cygdrive/c/Documents and Settings/wase/Local Settings/Temp\ $ ls *.jar
BusinessCSCommon28154.jar commons-beanutils28174.jar javax-ssl-1_228194.jar ordhttp28213.jar
BusinessCSMT28155.jar commons-collections28175.jar jdev-cm28195.jar ordim1128216.jar
LW_PfjBean28156.jar commons-digester28176.jar jewt428196.jar ordim28215.jar
adf-controller28157.jar commons-el28177.jar jmf28197.jar regexp28217.jar
adfm28158.jar commons-fileupload28178.jar jsp-el-api28198.jar share28218.jar
adfmtl28159.jar commons-lang-228179.jar jsse28199.jar standard28219.jar
adfmweb28160.jar commons-lang28180.jar jssl-1_128200.jar struts-legacy28220.jar
adftags28161.jar commons-logging28181.jar jssl-1_228201.jar struts28221.jar
aurora_client28162.jar commons-validator28182.jar ldapjclnt1028202.jar struts28230.jar
bc4jct28163.jar customizer28183.jar log28203.jar template28222.jar
bc4jctejb28164.jar datatags28184.jar log4j-128204.jar uix228223.jar
bc4jdomorcl28165.jar db2jcc28185.jar mediaplayer28205.jar uix2tags28224.jar
bc4jimdomains28166.jar db2jcc_license_cisuz28186.jar mts28206.jar uixadfrt28225.jar
bc4jmt28167.jar dms28187.jar multiplayer28207.jar xmlcomp28226.jar
bc4jmtejb28168.jar dsv228188.jar nls_charset1228208.jar xmlparserv228227.jar
bc4jutil28169.jar hawutil28189.jar ojmisc28209.jar xsqlserializers28228.jar
bigraphbean28170.jar help428190.jar oracle-el28210.jar xsu1228229.jar
classes1228171.jar inspect428191.jar oracle_ice28211.jar
classes12dms28172.jar jakarta-oro28192.jar oraclexsql28212.jar
collections28173.jar javax-ssl-1_128193.jar ordhttp1128214.jarAny suggestions for how I could pursue finding a resolution?
Thanks,
--Amy Smith -
How to run .jar on linux & how to create .jar file using java?
hi, may i know how to run .jar on linux & how to create .jar file using java? Can u provide the steps on doing it.
thanks in advance.Look at the manual page for jar:
# man jar
Also you can run them by doing:
# java -jar Prog.jar -
Help -- Trying to create JAR file but not working
Hi everyone
I have created a rather noddy Java program that consists of 4 JComboBox's and 1 JButton on a JFrame.
When the button is clicked a text file is generate with the options that have been selected.
There are severial files that the program uses for this:
gcc.java
OutToFile.java
gccConfirm.java
MyNewWindow.java
main.java
I am using Jcreator and so must use the command line to create the Jar file.
I have never done a jar file before so I did an example with a hello world program and got it working now problem. I did the same for this program and the JAR file is generated without error. I double click on the JAR file to run the application, but nothing happens. I can see the application running in memory but nothing loads on the screen. However if I run it from the command line using Java -jar gcc.jar then everything is ok.
can anyone help me here?
thanks in advanceIf you run you .jar from the command line (a shell in unix speak) there
already is a console where your java program can send it's System.out
stuff. Right click on your .jar and select 'properties' (or similar). Note
that your .jar is run by 'javaw'. This executable is similar to the 'java'
executable except that it doesn't open a console for you. Change the
'javaw' command to 'java' and voila, there's your console again.
kind regards,
Jos -
Help! How to create Jar file for a packaged class?
Hi!
I am new in jar complexities. I made a swing frame that just prompts a JOptionPane when executed. I accomplished the same using jar without packaging my class SwingTest.
But when i package it, it doesn't run. Can any one tell me how to make jar file of packaged classes and include images in the jar files too!
Really Thanx!Call the Jar from the commandline to see the exceptions thrown.
java -jar <jarFileName> <className>
Maybe you are looking for
-
Cannot get any SSD to work with my mid 2012 13 inch macbook pro!! PLEASE HELP!
I have tried over and over and NO ssd seems to work. All I get is a blank screen. This is very strange because I had a 128gb crucial m4 running firmware 000f for about 8 months before I decided to upgrade and never had a problem with it, not a single
-
How can we place an image in already created inline graphic frame?
Hi, AIM:: To place an image in the inline graphic frame. OBSERVATION:: As i have analysed the snippet Runner,i came to know that it allows to load the placegun with the file(in my case image). but in order to place it,we need to click on the document
-
Lost my bookmarks when I upgraded to new OSX Lion.. Can't find them and don't find firefox under the application support folder.
-
How do I get spry menu tab highlighted when on page ???
Hey guys I'm stuck I'm trying to get the tab in the spry menubar to be highlighted when each relevant page .. but something isn't right it's not working what am I missing here ??? now when I hover the btn disappears and when on the page the tab
-
ME_REQ_SOURCING_CUST Badi
Dear Gurus, We are on SRM 7 and configuring the Plan driven procurement scenario. As required, we have activated the BAdi 'ME_REQ_SOURCING_CUST' for transferring the purchase requisitions from ERP to SAP SRM. In the method ' IF_EX_ME_REQ_SOURCE_CUST~