Can't Execute JAR file deployed from JDev 903
Hi Everyone:
I took the Oracle beginning Java class, and got a copy of JDeveloper 9, and started in on a project. The task was to create a small module that will allow users with no direct SQL access to change their Oracle passwords. The good news is that it runs great from within JDev; it catches exceptions cleanly, it handles multiple databases with no problems. The bad news is that I cannot get it to run from a batch file or command line (client is Windows). I have run 'setvars', I have copied the CLASSPATH from the run window in JDev, all to no avail.
I am trying to deploy the app as an executable jar file. It's not meant to be an applet, because of the security implications.
I would gladly RTFM, but the FM's that I have gloss over the deployment step in Jdev. I figure it's something obvious, but I just cannot figure it out.
Any suggestions? Help a newbie...
Thanks,
Mike
Hi Mike,
I suggest you take a look at the log window of JDev, when you've successfully run your project.
If the log window is not displayed, go to View | Log.
Cut the command line, invoking javaw.exe, and paste it into your favorite editor.
Change javaw.exe into java.exe, save your file as a bat file, go in a DOS console, and run the bat file.
Let me know if it fixes your problem.
Thanks,
- Olivier
Similar Messages
-
Greetings
I read that jar files are executable unpon clicking them, but with me it do nothing.
right now i'm using the command prompt to decompress jar files
jar -xf jarfile.jar
i have windows xp professional with j2sdk1.4.1You can execute JAR files by double-clicking them if the JAR files have an appropriate manifest and your file associations are set correctly (i.e. make sure you open JAR files with JAVAW.EXE). You can learn more about the manifest here:
http://java.sun.com/docs/books/tutorial/jar/basics/manifest.html -
Hi all,
I Trying to deploy a simple J2SE app by making an Executable JAR File, however I don'r understand how to add a valid value to the Main Class field.
I followed the following description within Jdev, after creating a Deployment Profile:
Deploying an Executable JAR File
You can make your simple archive or J2EE Client Module into an executable JAR file that you can launch with the java command.
To deploy an executable JAR file:
1) Select and right-click the simple archive or client icon in the Navigator to display the context menu.
2) Choose Properties.
3) Click JAR Options in the tree.
4) Select Include Manifest File (META-INF/MANIFEST.MF).
5) In the Main Class field, enter the fully qualified name of the application class that is to be invoked.
7) Click OK.
8) Launch the executable JAR file from the command line:
java -jar myapp.jar
where myapp represents your JAR file name.
Like I said it's in 5) I'm doing something worng
My deploy-file (PlotPrint.deploy) looks the following:
<?xml version = '1.0' encoding = 'windows-1252'?>
<client-deployment xmlns="http://xmlns.oracle.com/jdeveloper/903/deploy/j2ee-client-jar" nselem="client-deployment" class="oracle.jdeveloper.deploy.jar.ClientProfile">
<archiveOptions>
<additionalManifests/>
<compressed>false</compressed>
<hasManifest>true</hasManifest>
<mainClass>PlotPrintClient</mainClass>
</archiveOptions>
<archiveTargetPlatform/>
<cdaSettings>
<additionalArchives/>
<afterFilters/>
<beforeFilters/>
<duringFilters/>
<selectedArchives>
<archives>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/jdbc/lib/classes12.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/jdbc/lib/nls_charset12.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/jdev/lib/jdev-rt.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/soap/lib/soap.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/lib/xmlparserv2.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/jlib/javax-ssl-1_2.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/jlib/jssl-1_2.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/j2ee/home/lib/activation.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/j2ee/home/lib/mail.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/j2ee/home/lib/http_client.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/webservices/lib/wsdl.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/lib/xmlparserv2.jar!/"/>
<Item protocol="jar" path="file:/C:/Oracle9i_Jdev/jdevbin/lib/xmlcomp.jar!/"/>
</archives>
<selectionMode>0</selectionMode>
</selectedArchives>
</cdaSettings>
<defaultConnection class="java.lang.String"/>
<deployClientMaxHeapSize/>
<earURL path="deploy/PlotPrint.ear"/>
<enterpriseAppName/>
<jarURL path="deploy/PlotPrint.jar"/>
<profileDeps/>
<properties/>
<selectedProjectFiles>
<autoInclude>true</autoInclude>
<deploySourceAs>0</deploySourceAs>
<files class="[Ljava.net.URL;"/>
<selectionFilters/>
</selectedProjectFiles>
</client-deployment>
I using Oracle9i Jdev, but have also tried it un the new Jdev 10g version, but the same problem everytime:
Error message: Could not find the main class: program will exit.
Please help I really need this to work
Message was edited by:
MHCI
Message was edited by:
MHCIYes that was the problem so I have changed the element mainClass to
<mainClass>xxPlotPrint.MHCI.PlotPrintClient</mainClass>
But now another probem has occured, since I get the following error when run the jar-file (When I run the app from within Jdev there are no warnings or errors).
----Batch-file-----
@echo off
java -jar PlotPrint.jar
echo Test Plot and Print Batch-file!
pause
---- out to cmd ----
Exception in thread "Thread-0" java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl
at xxPlotPrint.MHCI.NNE35_worker.run(NNE35_worker.java:42)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-2" java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl
at xxPlotPrint.MHCI.OCEJobDB_worker.run(OCEJobDB_worker.java:41)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-1" java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl
at xxPlotPrint.MHCI.NNE27_worker.run(NNE27_worker.java:42)
at java.lang.Thread.run(Unknown Source)
It's the same problem in all three exceptions (the exactly the same code), however I was a bit to quick this is the line (the line before I process the xml doc :-)
import org.w3c.dom.Element;
responseData = new Vector();
responseData = test_NNE35_SOAP.getXSDdoc();
Element elements = ( (org.w3c.dom.Element)responseData.elementAt(0) ); (line 42)
Please help I don't understad why I receive this exception, since I included the xmlparserv2.jar file, and don't even have a workaround :-( -
Can we make executable jar file which dont have main method?
I have a problem.
With whatever R&D i have done so far my understanding is that in order to create executable jar files i need a main method.
my problem is i have certain MIS reports which are developed in java and deployed through JSP pages...so my java program has no Main Method and only objects of the classes are being called in the JSP pages.
for e.g: i have a java class file BulkSms.class and i make an object of it in the JSP page through which my purpose is achieved by calling various method in the BulkSms through it s objects and there is no main method.
Can i make an executable jar file without a main method and if so please give me a detailed procedure of how to go about it.
i want to make it executable so tht on the click of it the MIS report is displayed from the JSP page.I am completely ignorant of JSPs, but you can not execute a jar or any java application unless you have a main method. It sounds like you need a way to launch the JSP - can't you do this with a browser?
-
Problem in loading applet from non executable jar file
hello ,
I am new to jar concept plz help.. I am trying to call an applet from another applet through frame it is working fine but its download time is much more. now i want to store all my images , sound files and class files of other applets in a jar file and want to access these inner applets from this jar file so that it will make only one http connection with the server for this jar file only and can reduce the download time of applet.
Can anyone can give me suggestion plz..
ThanxYou have to download what you have to download. You
probably can't easily share images between 2 separate
Jar files. Unless you can expose them through the
other applet via a method that can be known once you
have the reference to the other applet.Thanx but i think i have to elaborate the problem :
my project structure is just like this ::
on the top is ::
Applet A---> from this applet i am callling Applet B & Applet C in frame
and communication is established between these 3 applets successfully .
now i have made a single non executable jar file which contains images , sound and class files of these applets .
so i am referencing images and sound files in applets through this jar.
but i wanted to load Applet B & C through this jar file only.
How can i do this ??
Thanx .. I hope now the problem is clear -
Executing an file.exe from a jar file?
Does anyone know how to execute an *.exe file from jar file?
I have two files that I want to execute in one java.class, Monview.exe and Moninit.exe. Both are stored in the same jar file as the class called link.class.
This is my code to run one of the files from the hard drive
String []cmd={"c:\\monview.exe"};
try
Process pr = Runtime.getRuntime().exec(cmd);
StringBuffer buf = new StringBuffer();
InputStream istr = pr.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(istr));
String str;
while ((str = br.readLine()) != null) {
buf.append(str);
try {
pr.waitFor();
} catch (InterruptedException e) { }
if (pr.exitValue() != 0) {
br.close();
catch (IOException e){}
It works when i place both .exe on the local host harddrive but when I place it in the jar file nothing happens. Could anyone help me please on why does this happen and how I can fix it? Or on how to get the link.class code to extract it from the jar file and place it on the system directory and delete it from the system directory, without it knowing where the jar file comes from?Hello,
If I am not mistaken, by including the JAR file in the CLASSPATH (specifying the absolute path), or after the -classpath option after the java command (java -classpath jar_archive main_class), the system will find both files in the JAR archive.
Hope this helps! -
How can I add image files to a executable jar file ?
Could you tell me how can I add image files to executable jar file ?
package structure:
../com/Main.class
../images/..Please don't cross post, and read this
http://forum.java.sun.com/thread.jsp?forum=31&thread=271751
I've answered the question in the New To Java thread. -
Executable Jar files can't be run without command line
Hello,
A few months ago, I was messing with some executable jar files, but now I can't run them anymore without a batch file or command line, so how do I fix this?
Thanks in advance,
Yves W.
Edited by: Yves W on 18-dec-2010 15:56Open a command prompt.
Type
assoc .jarYou should get:
.jar=jarfileIf not, type:
assoc .jar=jarfileNow type:
ftype jarfileYou should get something like this (adjust the path to javaw.exe for your system):
jarfile="C:\Program Files\Java\jre6\bin\javaw.exe" -jar "%1" %*If not, type (adjust the path to javaw.exe for your system):
ftype jarfile="C:\Program Files\Java\jre6\bin\javaw.exe" -jar "%1" %* -
Executing .jar files from another .jar file.
How would I run one .jar file from another .jar file. and is there anyway to call specific class arguments? Because I have one .jar file that reads a specified file and returns its contents.
So how would I execute it and specify its arguments and how would I make it return something to the executing jar file?Because I have one .jar file that reads
a specified file and returns its contents. Presumably you have a class that does that, and you have that class stored in a jar. And you want to know how to... um... do something with that class. I say "um..." because normally you don't execute a class, either, you either call its static methods or you create an instance of the class and call its instance methods.
If you have been writing a whole lot of little classes each of which just has a static main method, then stop doing that. Write real Java classes instead. The tutorial is here:
http://java.sun.com/docs/books/tutorial/java/index.html -
How can I access EJB through executable jar file?
Hello buddies!!
I wonder if anyone could give me an explanation of how accessing EJB through executable jar file?Thanks!!Hi there,
You'll need to install the J2EE SDK on the client and include the <j2ee install dir>\lib\j2ee.jar file in your CLASSPATH along with the Client Jar file that was generated by the deploytool when you deployed the application.
In your client code the Context properties are as follows:
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
p.put(Context.PROVIDER_URL, "iiop://hostname:portnumber");
Context cntx = new InitialContext(p).Hope this helps
Amanda
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers -
Get name of executing jar-file (who-am-i)
Hi,
I'm planning to use a jar-file for a JAVA-application that holds all classes and an additional file with initial values (init.txt). This should allow an easy way to change initial behavior without having to recompile the code (I mean I could put all the initial values directly into the code). So I simply change init.txt and deploy the jar-file.
To achieve this I need a way to find out the name of the jar-file that is currently executing. With that I can open the jar-file from within the code and do the rest (I'm not going to bother you with this ;) ).
In C it was pretty simple, an argv[0] would do it. But how does it work in JAVA? I only have access to the parameters passed to the program.
EXAMPLE:
========
The command line looks like this:
java -jar MyApp.jar
MyApp.jar contains this (among others):
|- MyApp.class
|- init.txt
In this example I need to get the information that I'm "MyApp.jar". I already have the rest of the code so I'm only missing this little thingy.
Thanks beforehands for help.No, you should NOT need the name of your JAR file. You are probably coding it up the wrong way. If what you're after is to be able to read that "init.txt" file, then do so via something like:
InputStream initStream = getClass().getResourceAsStream("/init.txt");
rather than using filename-based API's. -
Can't open .jar file, nothing happens when I click, MAC OS 10.6.8
Hello,
I can't open .jar file, nothing happens when I click on the .jar file.
I have MAC OS 10.6.8
The thing it, I have desktop application that I'm building on Netbeans and when I compile and deploy it... it runs from Netbeans folder where I have all the files but copying the .jar on the desktop. It says "The Java JAR file "blablabla.jar" could not be launched check the Console for possible error messages"
Any idea or solution will be appreciated.
Thanks in advance
CharlesThese are Java files. http://www.java.com/en/ is where you can get the latest Java for your operating system. If your Java files need an older version of Java, there are instructions on the web to downgrade Mac Java, but it is difficult, and poses security issues.
-
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 -
Why -jar option used to install a software which is in executable jar file?
Hi all,
i have a query, i have a generic installer which is used to install the oracle weblogic 10.3 software in unix platform(i.e., which is in .jar extension) which is executable jar file.
To install this software which have to use -jar option to install
java -jar net_server<version>_generic.jar
my question that why we use -jar option to install or to extract the software
can any one clarify my doubt...
thanks in advance
abhi
Edited by: sumanth_abhi on Jan 27, 2009 11:50 PMAccording to the Jar Guide (http://java.sun.com/j2se/1.4.2/docs/guide/jar/jarGuide.html)
Executable Jar Files
On Microsoft Windows systems, the Java 2 Runtime Environment's installation program will register a default association for Jar files so that double-clicking a Jar file on the desktop will automatically run it with javaw -jar. Dependent extensions bundled with the application will also be loaded automatically. This feature makes the end-user runtime environment easier to use on Microsoft Windows systems.
The Solaris 2.6 kernel has already been extended to recognize the special "magic" number that identifies a Jar file, and to invoke java -jar on such a Jar file as if it were a native Solaris executable. A application packaged in a Jar file can thus be executed directly from the command line or by clicking an icon on the CDE desktop.
Despite that every JAR file can be executed as a program if and only if the META-INF/Manifest.mf contains the Main-Class tag. This done through java -jar jarfile.jar
--olaf -
Executable JAR file: Could not find the main class.
Hello,
I have a problem with making an executable JAR file.
I have written a JAVA program that consists of five different classes of which User.java is the main class and I have saved a text document with Main-Class: User and a blank line after that.
If I try:
jar cmf MainClass.txt User.jar User.class Beheerder.class Operator.class Manager.class MaakVisueelSchema.class
it makes a executable jar file which actually works! :)
But when the Operator class trys to open the MaakVisueelSchema class the screen stays blank.
I can run MaakVisueelSchema with java MaakVisueelSchema.
So I tried to make an executable JAR that consists only of MaakVisueelSchema, the same way as I did for User:
Main-Class: MaakVisueelSchema
jar cmf MainClass.txt MaakVisueelSchema.jar MaakVisueelSchema.class
Then I get the error message:
Could not find the main class. Program will exit.
from the Java Virtual Machine Launcher.
The big difference between MaakVisueelSchema and the other classes is that MaakVisueelSchema contains a PaintComponent method and an ComponentListener. Is it possible that one of those creates the error?
Can anyone help me with this problem?
Thanks in advance!
Bye!Yes,
I tried:
jar xvf MaakVisueelSchema.jar
and it returns:
META-INF/
META-INF/MANIFEST.MF
MaakVisueelSchema.classN/G. You need to manually create a manifest file in a text editor, have it point to your main class, and enter it in your jar command as an argument.
Maybe you are looking for
-
ITunes match does not work on my iPhone or iPad
I'm one of these lucky folks who has two Apple IDs because Apple decided to change from the single username to a MobileMe account a while back. Since Apple doesn't allow yet to concatenate both IDs, I have to use the single username ID for the iTunes
-
Problem with date format dd/mm/yyyy. But I need to convert yyyy-mm-dd.
Dear friends, I have the problem with date format. I receiving the date with the format dd/mm/yyyy. But I can upload to MySQL only in the format of yyyy-mm-dd. how should I handle this situation, for this I've created these code lines.But I have some
-
Few apps don't work after Anna update
I got a new N8 recently (my last one was stolen, insurance covered most of it though) but with the same product code and everything. Of corse, it didn't come with Anna pre-installed (it actually came with PR1.0 and I remembered how horrible the phone
-
Yosemite download is insanely slow (nothing wrong with my network)
Hi all, I'm trying to upgrade to Yosemite from Mavericks, or rather, I have been trying for the last 2 days. The download from the Mac store is crawling at a crazy slow rate. I've pulled about 1GB in 2 days now. It seems to get like 1MB downloaded ev
-
Hi, Gurus; Do you know the MDM ABAP API to call the import/syndication function as we did by client tool? In addition, I also would like to know the API that can call MDM workflow. I am working on MDM 5.5 SP05. Thanks for any feedback! Haiying