Solved

Jar and Policy file

Posted on 2004-09-10
9
284 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
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
 

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
return in catch statement 1 40
groovy example issue 10 67
Free Alternative to JIRA 4 55
unix in java example 9 42
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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

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

22 Experts available now in Live!

Get 1:1 Help Now