Solved

Jar and Policy file

Posted on 2004-09-10
9
289 Views
Last Modified: 2008-02-26
Hi All,
      Earlier we used to execute our application using the run.bat file containing the following command:
java -classpath .\lib -D"java.ext.dirs=.\lib"
-Djava.security.policy==client.policy com.sciatl.svt.ui.Login

      Obviously it opens up a dos console which we are trying to avoid in the current release and the only option is to package all the class file in a jar file. With the help of the manifest file i am launching the Login class.

Here is the manifest file:

Manifest-Version: 1.2
Created-By: 1.3.1 (Sun Microsystems Inc.)
Main-Class: com.sciatl.svt.ui.Login
Class-Path: lib/classes12.jar lib/ejb.jar lib/jaas.jar lib/jaxb-rt-1.0-ea.jar lib/jta.jar lib/oc4j.jar lib/oc4jclient.jar

Now i don't know how to specify the client.policy file in my manifest file or can i specify my policy file somewhere?

Kindly let me know if you have any suggestions or ideas.

Thanks & Regards,
Prem.
0
Comment
Question by:PRAC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 6

Expert Comment

by:expertmb
ID: 12024927
0
 
LVL 92

Expert Comment

by:objects
ID: 12024931
don't think you can sorry
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12024982
You can avoid the console window by invoking javaw in stead of java
I don't know the answer about the policy file.
;JOOP!
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:PRAC
ID: 12025085
Even if i use javaw instead of java, when i double click my run.bat the dos console window comes up.
0
 

Author Comment

by:PRAC
ID: 12025187
I am able to ignore the dos window by adding "start" before javaw in my run.bat file. Now my run.bat contains:

start javaw -classpath .\lib -D"java.ext.dirs=.\lib"
-Djava.security.policy==client.policy com.sciatl.svt.ui.Login

Thanks & Regards,
Prem.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12025331
I presume you run on Windows98 or ME : indeed that's a bug.

;JOOP!
0
 

Author Comment

by:PRAC
ID: 12025348
The OS is Windows XP.
0
 
LVL 1

Accepted Solution

by:
helloexpert earned 125 total points
ID: 12026414
try this

i.e, create an entry for the security policy in the manifest file as
Security-Policy=your file path

then in the java code, get the security policy like this

         JarFile jar = new JarFile(path);
          Manifest mfest = jar.getManifest();
          Attributes attr = mfest.getMainAttributes();
          String cp = attr.getValue("Security-Policy");

then use System.setProperty(..) to set the new policy file.

hope that helps.
0
 

Author Comment

by:PRAC
ID: 12033781
I am able to set my policy file using the following line in my Login class:
System.setProperty("java.security.policy", "client.policy");

Thanks to "helloexpert".
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cisco ASA: Java web start no go, asdm launcher no go 3 88
java mysql insert application 14 68
Java 8 to Java 6 8 44
replace an existing file in Dropbox 1 8
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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 tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.
Suggested Courses

752 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