Making Import / Export Of XML

Sep 17, 2014

I'm making an import/export of xml - I have the import of xml sorted I'm just trying to finish off the export. My export class is called XmlWriter.java. Inside the class I have an updateFile method to update an xml file as such:

public void updateFile(Environment environment,Document doc)
{
// code
}

I then in my main method have

public static void main(String argv[]){
 //declare new object of class
XmlWriter xmlWriter = new XmlWriter();
//test testUpdate method
// xmlWriter.testUpdate();
 Environment environment = ;

[code]....

I don't know what to make my variables equal to - eclipse keeps trying to use null but obviously that won't work. The Environment is another class that just contains getters and setters for the 3 different databases (that are in the xml file) and the getter/setter for the environment ID (also in xml file).

View Replies


ADVERTISEMENT

Export And Import Of Configuration Files

Apr 24, 2015

I have a library that I'm writing, the library contains a spring xml configuration file (lets say it's called libraryContext.xml) that sets the library up correctly for runtime, it also includes a test spring xml file that sets the library up for test by importing libraryContext.xml and overriding certain dependency injection beans (the library basically connects to a real database under normal conditions and uses dummy DAO's under test conditions). That bit is all fine.

The thing is, when I build the jar for the library (lets say it's called library-0.1.jar), the jar does not seem to contain the libraryContext.xml and that means that I can't import library.xml into my applications context.xml.

Basically, I have this line in my applications context.xml

Java Code: <import resource = "classpath:libraryContext.xml"/> mh_sh_highlight_all('java');

Unsurprisingly, since the xml file is not contained in the library-0.1.jar, the error I get is,

Java Code:

Offending resource: class path resource [applicationContext.xml];
nested exception is org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from class path resource [libraryContext.xml];
nested exception is java.io.FileNotFoundException: class path resource [libraryContext.xml] cannot be opened because it does not exist mh_sh_highlight_all('java');

With respect to potential solutions to the above problem, I could:

1) physically copy the libraryContext.xml file (and its other *.xml and *.properties dependencies) into the application, but then I'd have to maintain duplicate files - I don't like this option.

2) find out if there is a better way to handle this problem from people who know better. E.g. is there a way to embed the libraryContext.xml file (and it's dependencies) into the jar file so that it can then be imported into the application. I've spent a while on google trying to figure this out and haven't come up with anything overly useful (perhaps I've been using the wrong search parameters).

View Replies View Related

File Import Which Is Not Standard Import

Apr 5, 2014

Usually, most of the time, I import the standard java stuff.But what happens when I find a code with a list of those com. imports:

import java.io.File;
import java.io.IOException;
import com.itseasy.rtf.RTFDocument;
import com.itseasy.rtf.text.Border;
import com.itseasy.rtf.text.Field;

Where are these imports and how do I "get" them?

View Replies View Related

JSF :: How To Export Page To PDF

Apr 1, 2015

how to export a full jsf page to PDF. In my jsf page, I have a button to export to PDF and some fields where I am retrieving the values from a database. The form is ready but I don't know how to program code or program a button to export the page to PDF. I tried to search for an easy and a standard way but unfortunately I didn't find any useful example or code.

View Replies View Related

How To Export The Page To PDF

Apr 1, 2015

How to export a full jsf page to PDF. In my jsf page, I have a button to export to PDF and some fields where I am retrieving the values from a database. The form is ready but I don't know how to program code or program a button to export the page to PDF.

View Replies View Related

Export To Jar With More Than 1 Class

Feb 8, 2014

I create a snake game. Ant this game have more than 1 class. So i need this thing export to jar.. So i have question:

1.Do i have insert to public static void main(String[]args) method to somewhere class?
2.How to export to jar with more than 1 class..

And again, if I must insert main method in somewhere class, so which class?

snakeCanvas.java :

import java.awt.Event;
import java.awt.Point;
import javax.swing.event.*;
 import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.image.BufferedImage;

[Code] .....

View Replies View Related

Export To Runnable Jar

Oct 29, 2014

My app uses docx4J, XStream, and also uses an image on the start page. I placed all of this external libraries in Java Buid Path and in Eclipse it all works well but when I export all data to runnable jar file it doesn't work.

View Replies View Related

JSP :: Export To PDF Format

May 24, 2006

I'm doing a project in JSP and Oracle..Here in my project there are two types of department.. Accounts and Sales.. Accounts department is able to download some pages to Excel format and it is working properly.. now in the sales they have to download in pdf format.. then only it is possible to send to the HO..now what they are doing is downloading the JSP page in excel format and converting to pdf manually using the Acrobat Printer.. is that possible to change to pdf format.. for converting to excel format.. i'm just using 2 linesand it is here

<%@ page language="java" session="true" import="java.sql.*" import="java.lang.*" contentType="application/vnd.ms-excel" %><%response.setHeader("Content Disposition","attachment; filename=test.xls");%>

in the filename side i chaged to test.pdf.. and in the contentType i changed to Acrobat readerand it is downloading but cannot view the content

View Replies View Related

MySQL DB Export To Excel Using JXL?

May 2, 2015

I am trying to export a DB record to an excel sheet. Below is the code which I tried. I am not getting any error but still only the first record of the table is getting inserted into the excel sheet. But when I try printing, I prints all the records. Below is the code I did to insert records.

for (int i=0;i<ColumnCount;i++) {
System.out.println("Inside for");
Label label=new Label(i,0,rsmd.getColumnName(i+1),cellFormat);
sheet.addCell(label);
WritableCell cell = sheet.getWritableCell(i+1, 0);
System.out.println("Column " + rsmd.getColumnName(i+1)+ " inserted");
cell.setCellFormat(cellFormat);

[code]....

I hope i am making a logical mi stake in the for loop. But still i am unable to locate that.

View Replies View Related

JSP :: Java Program To Export To Excel

May 28, 2014

I have a JSP and Java program which will read data from Excel and add them dynamically to create table.My requirement is i should able to edit the columns what ever the data that was fetched from Excel and export those contents to another excel file.This should happen on clicking a button, i mean to exporting the contents of the table.

View Replies View Related

Java Game Export Error

May 8, 2014

So I am creating a game in Java, the game works fine when I run it in Eclipse but when I export it it does not draw anything on the screen.

I added a try and catch for nullpointerexceptions but the game does not throw any nullpointerexceptions.

What is the problem?

The game seems to be finding all the images & resources since it does not throw any NullPointerExceptions...

View Replies View Related

JSF :: Export To Excel With Indexing Feature With Icefaces 1.8.2

Feb 24, 2014

As of now am using icefaces 1.8.2 provided tags for downloading data into excel sheet where i can download all the data from a data table. But now the requirement is like need to download the data into excel sheet based on values passed from UI as parameters to the action class method.

Attaching the code snippet along with this post.

CustomerList.xhtml :-
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<ice:outputLabel value="Export:" />

[Code] ....

View Replies View Related

Export Runnable Jar File That Requires LWJGL

Aug 13, 2014

I'm trying to export a runnable jar file that requires lwjgl. Everything works in eclipse as I'm using

-Djava.library.path=nativewindows

as a VM Argument for the jinput .dll files.

After exporting & launching the jar it doesn't work of course! I get this error:

java.lang.UnsatisfiedLinkError: no junput-dx8 in java.library.path

I'm not sure how to make it work outside of eclipse....

View Replies View Related

Export Solaris Display On Linux And Trying To Launch JNLP

Feb 23, 2015

I am trying to export Solaris Display on Linux and trying to launch JNLP.

I am trying to follow the instruction mention in the following URL.

[URL] .....

I would like use the property mentioned in the above article in JNLP file on client side .

I did following nothing is working.

1. <argument>awt.toolkit=sun.awt.motif.MToolkit </argument>
2. <property name="awt.toolkit" value="sun.awt.motif.MToolkit"/>
3. java-vm-args="-Dawt.toolkit=sun.awt.motif.MToolkit"
4. export AWT_TOOLKIT=MToolkit

How do i check JNLP client is using it?

View Replies View Related

Java Servlet :: Not Able To Export File As WAR To Webapps In Tomcat Home

Jun 30, 2013

Below is my first servlet program:

FirstServlet.java:
 
package edu.aspire;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;

[Code] .....
 
web.xml:
 
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">

[Code] ....
 
Deployement:

To deploy my project into %TOMCAT_HOME%webapps folder.
Right click on Project ->Export-> War File
Project Name: Hello
Destination: D:Program FilesApache Software FoundationTomcat 6.0webappsHello.war
 
Result found in web browser:

HTTP Status 404 - /Hello/first 
And Hello.war file is not found in webapps folder too after exporting as .war.
I am using Apache tomcat 6.0.37, eclipse 3.7.2 release, tomcat plugin :com.sysdeo.eclipse.tomcat_3.3.0

View Replies View Related

Servlets :: Fetch Data From Backend (DB2) And Export To Excel - Slow File Download

Jan 31, 2014

Recently we got an issue about file download. We are using below code to fetch the data from backend(DB2) and export to excel.

Before Jan 15 it use to take 2 minutes to download the file (2 MB size). But now its taking half an hour to download.

response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition","attachment; filename=Attendance_Report.xls");

We have restarted server, system but still problem exists. We found that there is no code level or data base level or network level issues.

Now we have to see server level issue. What are the factors which effects the file downloading at server level.
We are using websphere 6.1 ,java1.4

View Replies View Related

JSP :: How To Import / Refer Css

Aug 7, 2014

accdg to this: [URL]....

we can use EL expression as follows:

${pageContext.request.contextPath}

but there's no instructions as to how I will set its value.

And also, what would happen in case I refer 2 css files in my jsp and both defines the following:

CSS 1 :
body { background-color: #fdf5e6;
font-size: 810px;
}

CSS 2:
body { background-color: #fdf5e6;
font-size: 50px;
}

View Replies View Related

How To Import Certificates From One JVM To Another

Jul 1, 2015

i am migrating my web application from Server1 (Tomcat 5 and Java 1.5) to Server2 (Tomcat 7 wand Java 1.6).

In my web application, I have multiple adapters (web clients) that are connecting to external web services, https interfaces, sftp servers etc.

In order to connect with all these external interfaces, i have installed multiple certificates in my JRE keystore on Server1.
 
Now since the application is going to be migrated to Server2, i need to know if there is any way I can import all the existing certificates from Server1 JRE to Server2 JRE?
 
Since the application has been running on Server1 for a long time, I am not sure, what exactly is a complete list of certificates that I need to install on my Server2 JRE.
 
So i am kind of looking how can i generate the keystore file with certificates from the existing server1 JRE and then import it into Server2 JRE.
 
Does this command provide a list of all the installed certificates on my Server1 JRE?

server1:/webdienste/java/jdk/xxx/current/jre/lib/security> sudo /webdienste/java/jdk/xxx/current/bin/keytool -list -v -keystore cacerts | grep Eigner

The other solution i can think of is to manually download/save all the certificates by opening all the URLs in the browser and then import the .pfx files through keytool into my Server2 JRE.

View Replies View Related

How To Get Sound To Import It To Game

Apr 7, 2015

how to make a simple game. I am having trouble when it comes to adding sound though. It tells me to do this:

package net.game.Game;
 
import java.applet.Applet;
import java.applet.AudioClip;
 public class Sound {
public static final AudioClip BALL = Applet.newAudioClip(Sound.class.getResource("ball.wav"));
public static final AudioClip GAMEOVER = Applet.newAudioClip(Sound.class.getResource("gameover.wav"));
public static final AudioClip BACK = Applet.newAudioClip(Sound.class.getResource("back.wav"));
}

What this does is it gets the sound file then gives it a name(BALL=ball.wav GAMEOVER=gameover.wav ect..) and then there is other code in other classes that call the sound so it will run but it keeps giving me an error and I don't know what to do. How can I get it to import the sound? Here is the error.

PHP Code:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at net.game.Game.stuff.<init>(stuff.java:35)
    at net.game.Game.stuff.main(stuff.java:62)
Caused by: java.lang.NullPointerException
    at sun.applet.AppletAudioClip.<init>(Unknown Source)
    at java.applet.Applet.newAudioClip(Unknown Source)
    at net.game.Game.Sound.<clinit>(Sound.java:7)
    ... 2 more 

View Replies View Related

Import All Library Within Directory

Sep 1, 2014

I see you can import in 2 ways:

import java.util.*;

or

import java.util.Scanner/Random/etc;

if I used the first one it imports all the librarys within that (directory?). If so would that add to a bigger file size?

View Replies View Related

Finding The Right Import Statement?

Feb 13, 2014

Often times i don't remember which package a specific class (like ArrayList) belongs to. Is there an easy way to find that java.util.* is what i need to import, if i wanted to use the class ArrayList ?

View Replies View Related

Import Class From Jar File

Jun 4, 2014

How to use a .class file I unpacked from a .jar file I downloaded from the Internet.

I downloaded the commons-io-2.4.jar file from commons . apache . org /proper/commons-io/

In it you can see that there is a class called FileUtil.class:

jar tf commons-io-2.4.jar | grep FileUtil
org/apache/commons/io/FileUtils.class

I extracted this with the following command:

jar xf commons-io-2.4.jar FileUtils.class

It is now in ..uk/ac/ebi/bioinvindex/services/datasearch/commons/FileUtils.class

Now, I have a java file where I would like to use FileUtils.

How do I do that? How do I import it?

View Replies View Related

How To Import A Spring Application

Apr 21, 2015

I have imported several maven projects but I am trying to import a spring project via eclipse and it is not displaying. I did the following file->import->Existing maven projects->browse (found my project)->finish..... The project does not display and I cannot find it. I tired to do it again and the project cannot import because I cannot select it meaning it is already installed.

View Replies View Related

How To Import Many Images Into Array

Feb 24, 2015

I am still playing around with decks of cards, and am now trying to implement some visualizations using Applets.

Here is how I enter my deck of cards into an array list: this works just fine:
 
String[] Suits = new String[]{"S","H","D","C"};
String[] Values = new String[]{"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
ArrayList<String> deck = new ArrayList<String>();
for(String suit : Suits) {
for(String value : Values) {
deck.add(suit+"_"+value);
}
}

The end result of this is an array 'deck' which contains a string representing each of the 52 playing cards. Great.

Now I would also like to use some pictures for future implementations I am working on. I have 52 images (.png, though I doubt it matters) stored in the right place. They are named as "H_5.png", and "S_A.png", for example, just as I named the cards in the previous array. I would like to do something as follows

ArrayList<Image> deckpic = new ArrayList<Image>();
for(String suit : Suits) {
for(String value : Values) {
deckpic.add(getImage(suit+"_"+value+".png"));
}
}

Now of course this doesn't work. The line

suit+"_"+value+".png"

is a string, not the name of a file. How I have previously loaded images is to use something like this:

the_pic = getImage("picture_of_pony.jpg");

but of course I can't use the quotations in my card loop, since I want "suit" and "value" to range and not just be the strings suit and value.

View Replies View Related

JSP :: JSTL Import Not Working?

Jan 25, 2014

I have the following data in a file called books.xml in my WEB-INF folder:

<?xml version="1.0"?>
<books>
<book>
<name>Padam History</name>

[Code] ....

I'm using the following code in a jsp:

<c:import var="bookInfo" url="/WEB-INF/books.xml" />

I know that it's finding the file because if I delete books.xml from the WEB-INF folder I get a FileNotFound exception.

However, for some reason it doesn't appear to be importing the data into the bookInfo variable.

I noticed this problem because when I try to parse it via:

<x:parse xml="${bookInfo}" var="output"/>

I get org.xml.sax.SAXParseException: Premature end of file.

When I try to display the data in the variable either by:

<c:out value="${bookInfo}" />

...or by means of a scriptlet (which I realize is not a best practice):

<%
String myVariable = (String)pageContext.getAttribute("bookInfo");
System.out.print("bookInfo=" + myVariable);
%>

...I get nothing.

BTW when I do:

<c:import var="data" url="http://www.tutorialspoint.com"/>
<c:out value="${data}"/>

that works fine!

View Replies View Related

Package Not Recognized On Import

Oct 16, 2014

This code doesn't recognise the package ( and therefore class ) timetest3, when I try to import it. The package I try to reference/call, follows, and works fine.

import javax.swing.JOptionPane;
import timetest3.TimeTest3;
public class timetest4 {
public static void main(String args[]) {
TimeTest3 time = new TimeTest3();
time.setTime(13,45,52);

[Code] ......

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved