Java IO package plz! help me
hi ,
i m very confused what's the use of FIleDescriptor class ?will anyone will explain it?
in the constructor of PrintStream class what this flush variable means.when i set this value to false nothing is dsplayed on the screen . Y ?
Did you go through the documentation?
What were you not able to understand after reading it?
ram.
Similar Messages
-
i have 2 file, MyClass0.java and MyClass1.java, in same directory:
.\MyClass0.java
.\MyClass1.java
if both are no package as:
//-------- MyClass0.java
import java.awt.*;
public class MyClass0{}
//-------- MyClass1.java
import java.awt.*;
public class MyClass1 extends MyClass0{}
i directly compile MyClass1.java (without compile MyClass0.java), compilling is successful and both MyClass0.class and MyClass1.class are generated (i know why).
here is my question:
if both have package: (add: package pack; to each file)
i directly compile MyClass1.java again (without compile MyClass0.java - class files are deleted before complling), compile error, no any class file is generated!
how are things going?
why no compile error if no package but has error if packaged?
plz help me, thx.why no compile error if no package
but has error if packaged?Because the compiler cannot find any source code file or class file that would match the given class name.
This is exlpained in more detail in the "setting the classpath" document in:
http://java.sun.com/j2se/1.3/docs/tooldocs/tools.html
The compiler always expects packaged classes and source code files in a directory structure similar to the package structure. If you are invoking the compiler on MyClass1 with "javac MyClass1.java", it will expect that classes and source code files in package "pack" will be in a subdirectory called "pack." The compiler can easily find MyClass1.java since you give the file name to it, but the definition for MyClass0 will be searched for in the subdirectory that doesn't exist.
It should compile fine if you invoke the compiler as "javac -d . *.java" instead, but I cannot verify this because I have a newer version of the SDK. The "-d ." makes the compiler put class files in the current directory, so that means that it will create the needed subdir automatically. -
MultiThreads and java.io.InterruptedIOException, Plz. help
Dear javas,
I have a multithreaded application, where I'm using wait and notify to make my thread communications, I'm using the java.io.File to get a list of files in the local folder, then read all these files and use the content of the files as my input, my problem is some time a java.io.InterruptedIOException is throwen, and I don't know why?
it is thrown when I'm trying to read the content of the file, I browsed the Net for more than three days, and no bugs are reported or one have reported any thing.
did I miss something??
Bye the way, the problem happen on unix just, and not with windows
also it happen with my code and with log4j package
did any one have an idea or can help me?
I ahve to deliver the project in the next comming day, and I'm stuck with this thing.
I did find a work around with my code, but I can't do any thing with log4j
I appreciate your help.did you read the exception description? obviously the thread reading the data was terminated too early. there could be an architectural problem with your design, e.g. the reader thread is a daemon thread and the main thread terminates without waiting for all tasks to be terminated.
robert -
Java Newbie Problem : plz help
I'm having problem with the java command :
[root@myServer datos]# export CLASSPATH=/usr/local/jdk/lib:/opt/tomcat/webapps/axis/WEB-INF/classes/org/enyuq/software/datos
[root@myServer datos]# /usr/local/jdk/bin/java InformacionServidorLicencias
Exception in thread "main" java.lang.NoClassDefFoundError: InformacionServidorLicencias (wrong name: org/enyuq/software/datos/InformacionServidorLicencias)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
[root@myServer datos]# /usr/local/jdk/bin/java org.enyuq.software.datos.InformacionServidorLicencias
Exception in thread "main" java.lang.NoClassDefFoundError: org/enyuq/software/datos/InformacionServidorLicencias
[root@myServer datos]#
Can anybody help me with this error?
Thankssome of the reasons why most people get this error
The java file has not been compiled
The java class does not have a main method(Applet or servlet) and is being run with the wrong tool.
typing error for the name of the class -
Need suggestions to start java card prog. plz help!!
hi ppl....
I am new to java card programming, but not to java programming. As a starter, i need to know ..... how to write a basic java card app?? Further, i also want to get the knowledge of testing/running this app on any simulator (if available). Can someone tell me that if i need to run my card application on real "smart card" (NOT on simulator), then what i need to have ... i mean any card processor or interface with PC. Any help will be much appreciated.
Raheel.Download the sun kit and read the manuals
-
About Adobe CS3 Design Premium Software Package Plz Help.
Hi All,
I am doing a course in Designing Websites With Dreamweaver my
lecturer has told me to buy the Adobe CS3 Design Premium Software
package as I would like to be self employed selling my own
websites, my question is: how often will I need to upgrade the
Adobe CS3 Design Premium Software package (commercial use) do I
have to do it every time new Adobe Software comes out? is it
possible to leave it until the second or third new version of Adobe
CS3 Design Premium Software package comes out so I will be able to
get the upgrade version?
My other question is: my lecturer has advised me to buy the
Student Version of Adobe CS3 Design Premium Software package (for
non commercial use) is it true that Adobe will limit your usage? if
yes how do they do it? as there are probably millions of Adobe CS3
Design Premium Software packages in the UK alone!
Thank You For Reading This And Maybe Replying To It.
Yours Sincerely,
Oliver> last question I promise (lol): What is the difference
between the Full
> Version
> and the Upgrade Version?
Functionally, nothing but from a licensing point of view:
everything.
A Full version of the software is a brand new license so the
software can be
installed on a computer which does not already have the
software installed.
e.g. CS3 Full version + CS3 Full version = CS3 (2 licenses; 1
on each
computer))
An Upgrade version is merely an upgrade to an existing
license. i.e. can
only be used to upgrade an existing, qualifying installation
of the software
on a computer. An upgrade cannot be installed on a computer
which does not
already have an earlier qualifying version of that software
installed.
e.g.
CS2 Full version + CS3 Upgrade = CS3 (1 license)
CS Full version + CS3 Upgrade = CS3 (1 license)
Version 7 Full version + CS3 Upgrade = CS3 (1 license)
But Version 6 Full version + CS3 Upgrade = cannot be done
because Version 6
does not qualify for a CS3 upgrade license (Adobe policy).
Regards
John Waller -
Hi Folks,
I am new in Java programming, have a .jar file that contains .java files that I want no access and use from another .java file. These files in the .jar file basically form a library thus have no main-method. However I can not declare an instance of the library (in the .jar file) and use it within my program.
Plz help ...I have tried all I know in vain.
Thanks.temba wrote:
Hi Folks,
I am new in Java programming, have a .jar file that contains .java files that I want no access and use from another .java file. These files in the .jar file basically form a library thus have no main-method. However I can not declare an instance of the library (in the .jar file) and use it within my program. You are making little sense. You can't instantiate .java files.
Plz help ...I have tried all I know in vain.
Thanks.Could you post WHAT you have tried and also post what error messages you received? -
Java Mail Project HELP Required....URGENT PLZ HELP!!!
hello there!!
i took up a pjct for my engineering on java mail..got the code..and i thought that ill analyse it...the code is submitting the mail to the smtp server but after dat its failing to deliver to the client..as i can see this error in the logs on SMTP server...can anyone help me out in analysing this code!!!
plz help, exams are near...(am new to java)
//java FINAL!
import javax.swing.*;
import java.net.URL;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
public class EmailProg extends JPanel implements ActionListener {
protected JTextArea textArea;
protected String newline = "\n";
static final private String composemail = "compose";
static final private String sendmail = "send";
static final private String about = "about";
static final private String submit = "submit";
static final private String exit = "exit";
JLabel lSubmit = new JLabel("Submit");
JButton subbutton = new JButton();
JTextArea emailfrom = new JTextArea(1,1);
JTextArea emailto = new JTextArea(1, 1);
JTextArea emailsubject = new JTextArea(1, 1);
JTextArea emailmessage = new JTextArea(25, 1);
//------BAG LAYOUT
JLabel lFrom = new JLabel("From:");
JTextField cFrom = new JTextField(32);
JLabel lTo = new JLabel("To:");
JTextField cTo = new JTextField(32);
JFrame frame2 = new JFrame("Compose New");
JLabel lSubject = new JLabel("Subject");
JTextField cSubject = new JTextField(32);
JLabel lMessage = new JLabel("Body");
JTextArea cMessage = new JTextArea(5,32);
//====================================
public EmailProg() {
super(new BorderLayout());
//Create the toolbar.
JToolBar toolBar = new JToolBar();
addButtons(toolBar);
//Create the text area used for output. Request
//enough space for 5 rows and 30 columns.
textArea = new JTextArea(5, 30);
textArea.setEditable(false);
textArea.setText("Welcome to Jeff's email program! With this program you can compose and send emails. I hope I get a good grade on thise, and marine world finds a good use for it :-D:-D (implements really just testing the scroller!!!)");
JScrollPane scrollPane = new JScrollPane(textArea);
//Lay out the main panel.
setPreferredSize(new Dimension(450, 110));
add(toolBar, BorderLayout.NORTH);
add(scrollPane, BorderLayout.CENTER);
//==================================
protected void addButtons(JToolBar toolBar) {
JButton button = null;
//first button
button = makeNavigationButton("/toolbarButtonGraphics/general/ComposeMail24.gif", composemail ,"Compose new Email", "compose new");
toolBar.add(button);
//second button
button = makeNavigationButton("toolbarButtonGraphics/general/SendMail24.gif", sendmail,"Send The Mail","send");
toolBar.add(button);
//third button
button = makeNavigationButton("toolbarButtonGraphics/general/About24.gif", about,"About","About");
toolBar.add(button);
//exit button
button = makeNavigationButton("toolbarButtonGraphics/general/Stop24.gif", exit, "Exit", "Exit");
toolBar.add(button);
//===================================
protected JButton makeNavigationButton(String imageName, String actionCommand, String toolTipText, String altText) {
//Look for the image.
String imgLocation = imageName;
URL imageURL = EmailProg.class.getResource(imgLocation);
//Create and initialize the button.
JButton button = new JButton();
button.setActionCommand(actionCommand);
button.setToolTipText(toolTipText);
button.addActionListener(this);
if (imageURL != null) { //image found
button.setIcon(new ImageIcon(imageURL));
} else { //no image found
button.setText(altText);
System.err.println("Resource not found: "+ imgLocation);
return button;
//=============================
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
String description = null;
// Handle each button.
if (exit.equals(cmd)){
textArea.setText("");
description = "EXITING";
System.exit(0);
if (composemail.equals(cmd)) { //first button clicked
textArea.setText("");
description = "Write new mail.";
composeWindow();
} else if (sendmail.equals(cmd)) { // second button clicked
textArea.setText("");
description = "This button does'nt do anything yet :x";
} else if (about.equals(cmd)) { // third button clicked
textArea.setText("");
description = "About this program. (See pop-up)";
coolWindow();
else if (submit.equals(cmd))
if (cFrom.getText().equals("")||cTo.getText().equals("")||cSubject.getText().equals("")||cMessage.getText().equals(""))
textArea.setText("One or more of the fields was not filled in.");
else{
try {
String smtpServer="serverhere";
String to=cTo.getText();
String from=cFrom.getText();
String subject=cSubject.getText();
String body=cMessage.getText();
send(smtpServer, to, from, subject, body);
textArea.setText("");
description = "Mail Sent.";
JOptionPane.showMessageDialog(null, "Message Sent.");
catch (Exception ex)
System.out.println("Usage: java com.lotontech.mail.SimpleSender"
+" smtpServer toAddress fromAddress subjectText bodyText");
//CLOSE THE FRAME2 WINDOW IIIIIIIIFFFFFFF SENDING IS SUCCESSFUL!!
}//end of else during send
}//end of if of submit
displayResult(description);
//============================
protected void displayResult(String actionDescription) {
textArea.append(actionDescription + newline);
//=============================
public void coolWindow() {
JFrame frame = new JFrame("About");
JTextArea filecontents = new JTextArea();
filecontents.setText("Use the tool bar to compose\n compose new emails, in which you can\n send to anyone on the\n srvhs email server. \n Fill in all the blanks before pressing send. If you dont\n you will receive an error! \n For more information about this program click on the\n information button.");
frame.getContentPane().add(filecontents, BorderLayout.CENTER);
frame.pack();
frame.setResizable(false);
frame.setSize(300,200);
frame.setVisible(true);
//===============================
public void composeWindow() {
frame2.getContentPane().setLayout(new GridBagLayout());
frame2.setResizable(false);
frame2.setSize(600,500);
frame2.setVisible(true);
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(5, 10, 5, 10);
cMessage.setLineWrap(true);
subbutton = makeNavigationButton("toolbarButtonGraphics/general/SendMail24.gif", submit,"submit","submit");
addRow(gbc, lFrom, cFrom);
addRow(gbc, lTo, cTo);
addRow(gbc, lSubject, cSubject);
addRow(gbc, lMessage, cMessage);
addRow(gbc, lSubmit, subbutton);
//===============================
private void addRow(GridBagConstraints gbc, Component left, Component right) {
gbc.gridx = GridBagConstraints.RELATIVE;
gbc.gridy = GridBagConstraints.RELATIVE;
gbc.gridheight = 1;
gbc.gridwidth = 1;
gbc.anchor = GridBagConstraints.EAST;
frame2.getContentPane().add(left, gbc);
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.anchor = GridBagConstraints.WEST;
frame2.getContentPane().add(right, gbc);
frame2.pack();
//=======================
public static void send(String smtpServer, String to, String from, String subject, String body) {
try {
Properties props = System.getProperties();
props.put("localhost", smtpServer);
Session session = Session.getDefaultInstance(props, null);
System.out.println(smtpServer);
// -- Create a new message --
Message msg = new MimeMessage(session);
// -- Set the FROM and TO fields --
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
// -- We could include CC recipients too --
// if (cc != null)
// msg.setRecipients(Message.RecipientType.CC
// ,InternetAddress.parse(cc, false));
// -- Set the subject and body text --
msg.setSubject(subject);
msg.setText(body);
// -- Set some other header information --
msg.setHeader("X-Mailer", "LOTONtechEmail");
msg.setSentDate(new Date());
// -- Send the message --
Transport.send(msg);
System.out.println("Message sent OK.");
catch (Exception ex)
ex.printStackTrace();
public static void main(String[] args) {
JFrame frame = new JFrame("EmailProg");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
EmailProg newContentPane = new EmailProg();
newContentPane.setOpaque(true);
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
}The code to retrieve the messages from SMTP
finally all working fine...
thanx guys!!!
package EmailProg;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
* A simple email receiver class.
public class SimpleReceiver
* Main method to receive messages from the mail server specified
* as command line arguments.
public static void main(String args[])
try
String popServer=args[0];
String popUser=args[1];
String popPassword=args[2];
receive(popServer, popUser, popPassword);
catch (Exception ex)
System.out.println("Usage: java com.mail.SimpleReceiver" +" popServer popUser popPassword");
System.exit(0);
* "receive" method to fetch messages and process them.
public static void receive(String popServer, String popUser, String popPassword)
Store store=null;
Folder folder=null;
try
// -- Get hold of the default session --
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props, null);
// -- Get hold of a POP3 message store, and connect to it --
store = session.getStore("pop3");
store.connect(popServer, popUser, popPassword);
// -- Try to get hold of the default folder --
folder = store.getDefaultFolder();
if (folder == null) throw new Exception("No default folder");
// -- ...and its INBOX --
folder = folder.getFolder("INBOX");
if (folder == null) throw new Exception("No POP3 INBOX");
// -- Open the folder for read only --
folder.open(Folder.READ_ONLY);
// -- Get the message wrappers and process them --
Message[] msgs = folder.getMessages();
for (int msgNum = 0; msgNum < msgs.length; msgNum++)
System.out.println(msgs[msgNum]);
catch (Exception ex)
ex.printStackTrace();
finally
// -- Close down nicely --
try
if (folder!=null) folder.close(false);
if (store!=null) store.close();
catch (Exception ex2) {ex2.printStackTrace();
} -
Package Problem : Plz help
I've make two classes named First.java and Second.java in e:\javafiles\test\vg folder
package vg;
public class First
public int m = 100;
public int n = 200;
package vg;
public class Second
public static void me0()
System.out.println("Stupid cant u see the value of m is zero");
public static void mgrn()
System.out.println("Yaar m is greater than n");
public static void neven()
System.out.println("The value of n is Even");
and a Third class
import vg.*;
public class Last
public static void main(String robert[])
Second d = new Second();
First f = new First();
if(f.m==0)
d.me0();
if(f.m>f.n)
d.mgrn();
if((f.n%2)==0)
d.neven();
else
System.out.println("The value of n is Odd");
Now the problem is that if I put the Last.java at e:\javafiles\test and compile it , it works fine but if I put the Last.java anywhere else e.g at e:\javafiles and try to compile it it does not works and gives error
E:\JavaFiles>javac Last.java
Last.java:1: package vg does not exist
import vg.*;
even if I change classapth variable as E:\javafiles\test or even E:\javafiles\test\vg
plz help me in this regardYou need to change where it is trying to find the 'vg' package. So, if your Last.java is in e:\javafiles, then you need to
import test.vg.*
e.g.
import test.vg.*; // Change this line
public class Last
public static void main(String robert[])
Second d = new Second();
First f = new First();
if(f.m==0)
d.me0();
if(f.m>f.n)
d.mgrn();
if((f.n%2)==0)
d.neven();
else
System.out.println("The value of n is Odd");
Alan -
Plz help using ms access as database,i want to create a login page in java
hye frnz... plz help me m new to java
m using ms access as database and try to create a login page where user type username and pw
i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
now there is an error class not found exception sun:jdbc...... error
plz help me i had stuck frm 4 days */
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Login extends JFrame
//Component Declarations
JLabel jlb1,jlb2;
JTextField jtf1;
JPasswordField jpf1;
JButton jb1,jb2;
//Constructor
Login()
//frame settings
setTitle("Login Dialog");
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Dimension d= Toolkit.getDefaultToolkit().getScreenSize();
setBounds(d.width/2-175,d.height/2-100,350,200);
gbc.insets=new Insets(7,7,7,7);
//adding components
jlb1=new JLabel("User ID");
gbc.gridx=0;
gbc.gridy=0;
add(jlb1,gbc);
jlb2=new JLabel("Password");
gbc.gridx=0;
gbc.gridy=1;
add(jlb2,gbc);
jtf1=new JTextField(10);
gbc.gridx=1;
gbc.gridy=0;
add(jtf1,gbc);
jpf1=new JPasswordField(10);
gbc.gridx=1;
gbc.gridy=1;
add(jpf1,gbc);
jb1=new JButton("Login");
gbc.gridx=0;
gbc.gridy=2;
add(jb1,gbc);
jb1.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ae)
Connection conn=null;
Statement stmt=null;
boolean found=false;
try
Class.forName("sun.jdbc.driver.JdbcOdbcDriver");
String dataSourceName = "Inventory";
String dbURL = "jdbc:odbc:" + dataSourceName;
conn=DriverManager.getConnection(dbURL, "","");
stmt=conn.createStatement();
ResultSet rst=stmt.executeQuery("Select * from User");
System.out.println(jtf1.getText()+"/t"+jpf1.getPassword());
while(rst.next())
System.out.println( rst.getString(1) +"/t"+ rst.getString(2));
if(jtf1.getText().equals(rst.getString(1).trim()) && new String(jpf1.getPassword()).equals(rst.getString(2).trim()))
found=true;
rst.close();
dispose();
MainWindow mw= new MainWindow(); /*created min window object created to be opend after login but not working*/
break;
rst.close();
stmt.close();
conn.close();
catch(ClassNotFoundException e){System.out.print(e);}
catch(Exception e){System.out.print(e);}
if(found==false) /*this portion is executing and dialog box appears invalid name and pw with class not found exception sun:jdbc.......on console */
JOptionPane.showMessageDialog(null,"Invalid username or password",
"Error Message",JOptionPane.ERROR_MESSAGE);
jb2=new JButton("Clear");
gbc.gridx=1;
gbc.gridy=2;
add(jb2,gbc);
jb2.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ae)
jtf1.setText("");
jpf1.setText("");
jtf1.requestFocus();
setSize(350,200);
setVisible(true);
jtf1.requestFocus();
public static void main(String args[])
Login l=new Login();
Edited by: 795772 on Sep 19, 2010 4:44 AM795772 wrote:
hye frnz... plz help me m new to java
m using ms access as database and try to create a login page where user type username and pw
i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
now there is an error class not found exception sun:jdbc...... error
plz help me i had stuck frm 4 days */
<snip>The subject of this forum is Oracle databases. How does your problem relate to that subject?
Two bits of advice:
1) Make sure you ask questions in a forum related to your problem.
2) If you want to be taken seriously as a professional, drop the MS IM Speak and use the language of the forum. In this forum it is English, which is successfully used by many people for whom English is far from their native language. -
Hey im brand new to java and i just downloaded and installed jdk-1_5_0_01-windows-i586-p now im tryin to set up the PATH permanently but i have no clue how to i went to the install notes and typed in C:\Program Files\Java\jdk1.5.0_<windows>\bin in the command.com but everytime i do it says access is denied. i have no clue how to set up the path permanently beside what i tried plz help!!!
You didn't which OS you are running, but it's fairly similar for all windows.
Start->settings->control panel->system->advanced->environment variables
Go to System variables, click on path, click edit button and add a semicolon and the path at the end. DO NOT REPLACE EVERYTHING THAT'S THERE NOW.
I don't have 1.5 installed on this computer, but I'm willing to bet the real path doesn't have '<windows>' in it. Use Windows Explorer to find out where java.exe actually exists on the hard disk and use that path -
How to use padding scheme FIPS81 in java plz help?
Plz refer the below code using this code I m trying to decrypt XLS file using pass phrase.
I m using the same pass phrase which was used @ the time of encryption.
But the problem I m facing is that the file was encrypted in DOT NET_ using padding scheme FIPS81 and there impelmentation of FIPS81 is not available in JAVA so that it gives exception at the time of decryption which is given below
Exception : javax.crypto.BadPaddingException: Given final block not properly padded
I urgently need the solution of this problem so somebody plz help me to find the solution of this problem.....Ur reply would be appriciated.....!!
The File is Encrypted using below mechanism
ALGORITHM : AES
MODE : ECB
PADDING SCHEME : FIPS81
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import javax.crypto.*;
import javax.crypto.spec.*;
public class DecryptTest {
public static void main(String[] s){
String passPhrase = "passphrase";
String encFileName = "encsample.xls";
String decFileName = "decsample.xls";
FileInputStream encFileIn = null;
FileOutputStream decFileOut = null;
File f = null;
byte[] message;
try {
f = new File(encFileName);
encFileIn = new FileInputStream(f);
decFileOut = new FileOutputStream(decFileName);
message = new byte[encFileIn.available()]; //Read the encrypted file in from disk
encFileIn.read(message);
SecretKeySpec spec = new SecretKeySpec(passwordToKey (passPhrase), "AES");
//decrypt it
Cipher c = Cipher.getInstance("AES/ECB/NoPadding");
c.init(Cipher.DECRYPT_MODE, spec);
System.out.println("Block Size is >-->" + c.getBlockSize());
String decryptedString = new String(c.doFinal(message));
System.out.println("Decrypted message: " + decryptedString);
//To write into another files
decFileOut.write(decryptedString.getBytes());
}catch (Exception e) {
System.out.println(e);
}finally {
try {
encFileIn.close();
decFileOut.close();
} catch (IOException ioe) {
}Is there any mechanism is available for FIPS81 or Is there any third party Provider available for it plz reply........????????I suggest you look in google http://www.google.co.uk/search?q=SWF+java
-
Help with Java.Sql package download
I am compiling some java files with the following :
import java.sql.*
and getting errors. I realize I need the java.sql package. Can anyone help me by pointing out where I can download the package?
Thanks.
Murthy GandikotaThis package comes with the JDK. what are your specific problems.
-
Plz help to install java plug-ins
hi everybody,
i am new to the world of java, i want to install java plug-ins in mozilla 1.7 on redhat linux 9.
how to do it, plz help, thanx in advance..If Java was installed prior to Mozilla, it should have automatically installed.
If not, or Mozilla was installed first, use these instructions from Mozilla:
http://plugindoc.mozdev.org/linux.html -
Hi,
I tried to run one simple RMI application..
I got the RMI Server running...
But While running the client I got the following Exception...
java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.net.SocketException: Broken pipe
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:129)
at engine.ServerMain_Stub.addTask(Unknown Source)
at client.ClientMain.initCompute(ClientMain.java:38)
at client.ClientMain.main(ClientMain.java:17)
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1639)
at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1548)
at java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1146)
at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1100)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1241)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052) at java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1355)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:281)
at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:265)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:124)
... 3 more
I am not able to understand the problem...
Plz help..
Regerds
Jijo VincentHi, I got same stack trace within RMIConnector.
MBean Server (= RIM Server) has bean alive, but a MBean client may get following Exception.
I'm guessing that a port on server side was closed, cause rmi object on server side was unbinded from the rmi registory by some trigger.
But I don't know what was the trigger for this...
Caused by: java.rmi.MarshalException: error marshalling arguments; nested exception is:
java.net.SocketException: Broken pipe
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:138)
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(RMIConnector.java:993)
at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:288)
... 7 more
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1847)
at java.io.ObjectOutputStream$BlockDataOutputStream.writeByte(ObjectOutputStream.java:1885)
at java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1546)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:333)
at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:274)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
... 11 more
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.6.0_24-b07
java.specification.name = Java Platform API Specification
java.specification.vendor = Sun Microsystems Inc.
java.specification.version = 1.6
os.arch = amd64
os.name = Linux
os.version = 2.6.18-194.el5
Maybe you are looking for
-
i have purchased 3 books from Itunes for my ipod. The books show up on the PC as purchased but do not show up on the Ipod anywhere. Other books i have bought and have downloaded correctly have a square symbol beside them - but the three books in que
-
A Macbook 1/1, a1186, OS 10.57, my friend "cleaned" her keyboard, and afterwards the i and k keys don't work. She did try pressurized air to disperse any physical particle. The keys work smoothly, and the Macbook responds properly to an external k
-
Sales order creation using BAPI is predefined function
then what is the necessity of creating again?Can any one explain clearly the need of creation of sales order using BAPI
-
Embedding an HTML page in a Flash Movie
I am trying to embed an HTML page in the center of a Flash movie and I was wondering if this is possible, and if so, what is the code to do so. I want it as a small box in the middle of my SWF.
-
Document properties has not fonts listed and not able to display korean font
Hi, I have a korean PDF file which I am using Adobe Acrobet 9 Pro to view the file. When I open the file, the text is all in not-standard characters. An example looks like the following: I tried to search to see if I am missing installing the font