?
Solved

Jar and Policy file

Posted on 2004-09-10
9
Medium Priority
?
293 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 375 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

718 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