How to compile a java class via SQL?
Hello,
What is the pl/sql command-line syntax for compiling a java class uploaded to the database?
I'm looking for a command i can use to compile some java code manually similar to:
ALTER TRIGGER SCHEMA.TRG_MYTRIGGER COMPILE;
Thanks
could try dynamic code generation, cglib, asm, eg
http://68.142.231.85/myresults/mycache?u=http%3A%2F%2F
www2.sys-con.com%2FITSG%2Fvirtualcd%2FJava%2Farchives%
2F0702%2Frichards&docid=FToU9dUOIw4HRHa%2F26Zi5Q&.intl
=us&.done=http%3A%2F%2Fmyweb.yahoo.com%2Fmyweb%3Fei%3D
UTF-8%26tag%3Dcode%2Bgenerationhmmmm, yes, bytecode generation is so much simpler, isn't it :-)
Similar Messages
-
How to compile the Java classes generated in JAXB
I am using Windows 2000 Operating System. I found a xjc
batch file on the sun's java forum.
I used that to generate classes from XML. After generating
the classes I could not compile
the classes each depends on other AND THEY REQUIRE BOTH
CLASS FILES.
I will attach the schema file and dtd . Can you explaine me the problem.
#<transactions.dtd>
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT transactions (cardtocard*)>
<!ELEMENT cardtocard (tocard, fromcard, fromcardver, amount, transdate, transid)
>
<!ELEMENT tocard (#PCDATA)>
<!ELEMENT fromcard (#PCDATA)>
<!ELEMENT fromcardver (#PCDATA)>
<!ELEMENT amount (#PCDATA)>
<!ELEMENT transdate (#PCDATA)>
<!ELEMENT transid (#PCDATA)>
transactions.xjs
<xml-java-binding-schema>
<element name="transactions" type="class" root="true"/>
<element name="cardtocard" type="class"/>
</xml-java-binding-schema>
XML file
?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
<transactions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\My Documents\Xml\SVTConcord.xsd">
<cardtocard>
<tocard>1111222233334444</tocard>
<fromcard>6666777788889999</fromcard>
<fromcardver>567</fromcardver>
<amount>100.00</amount>
<transdate>2002-06-04 00:00:00.000</transdate>
<transid>1111222202</transid>
</cardtocard>
</transactions>
the XJC compiler for windows is
@echo off
echo JAXB Schema Compiler
echo --------------------
if "%JAVA_HOME%" == "" goto errorJVM
if "%JAXB_HOME%" == "" goto errorJAXB
set JAXB_LIB=%JAXB_HOME%\lib
set JAXB_CLASSES=%JAXB_HOME%\classes
echo %JAVA_HOME%\bin\java.exe -jar %JAXB_LIB%\jaxb-xjc-1.0-ea.jar %1 %2 %3 %4 %5
%JAVA_HOME%\bin\java.exe -jar %JAXB_LIB%\jaxb-xjc-1.0-ea.jar %1 %2 %3 %4 %5
goto end
:errorJVM
echo ERROR: JAVA_HOME not found in your environment.
echo Please, set the JAVA_HOME variable in your environment to match the
echo location of the Java Virtual Machine you want to use.
echo For example:
echo set JAVA_HOME=c:\jdk1.4.0_01
goto end
:errorJAXB
echo ERROR: JAXB_HOME not found in your environment.
echo Please, set the JAXB_HOME variable in your environment to match the
echo location of the JAXB installation directory.
echo For example:
echo set JAXB_HOME=c:\jdk1.4.0_01\jaxb-1.0-ea
:endWhen you compile the generated classes, be sure to put jaxb-rt-1.0-ea.jar in your classpath!
-
Unable to compile the java class in the SQL PLUS
Hi Team,
I am unable to compile the java class in the SQL PLUS in dev1 and dev2. It is giving the following error.
But the same class get Compiled in the Toad(Tool) without any error and working fine. Could someone help me
What to do for this for your reference ,Attaching the java class file.
“ORA-29536: badly formed source: Encountered "<EOF>" at line 1, column 28.
Was expecting one of:
----------------------Here is the Java class Code.....................
create or replace and compile java source named "XXVM_ZipFileUtil_Ela"
as
import java.math.BigDecimal;
import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import oracle.sql.*;
import oracle.jdbc.*;
import java.sql.*;
import java.io.*;
public class XXVM_ZipFileUtil_Ela
public static oracle.sql.BLOB getZipFile(
oracle.sql.CHAR zipFilePathCHAR, oracle.sql.CHAR zipFileNameCHAR,
int fileBufferSize, int zipFileBufferSize,
boolean deleteZipFile, java.sql.Array fileNames, java.sql.Array fileContents, java.sql.Array fileContentsLength)
throws IllegalArgumentException, FileNotFoundException, IOException, java.sql.SQLException
String zipFilePath = (zipFilePathCHAR == null) ? null : zipFilePathCHAR.stringValue();
String zipFileName = (zipFileNameCHAR == null) ? null : zipFileNameCHAR.stringValue();
String zipPathAndFileName = new String(
new String(zipFilePath == null || zipFilePath == "" ? "/tmp/" : zipFilePath) +
new String(zipFileName == null || zipFileName == "" ? System.currentTimeMillis() + ".zip" : zipFileName));
byte[] buffer = new byte[fileBufferSize == 0 ? 100000000 : fileBufferSize];
try
Connection conn = DriverManager.getConnection("jdbc:default:connection:");
oracle.sql.CLOB[] fileContentsCLOB = (oracle.sql.CLOB[])fileContents.getArray();
String[] fileNamesString = (String[])fileNames.getArray();
BigDecimal[] fileContentsLengthNumber = (BigDecimal[])fileContentsLength.getArray();
ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipPathAndFileName));
zipOut.setLevel(Deflater.DEFAULT_COMPRESSION);
for (int i = 0; i < fileNamesString.length; i++) {
System.out.println(i);
zipOut.putNextEntry(new ZipEntry(fileNamesString));
InputStream asciiStream = fileContentsCLOB[i].getAsciiStream(1L);
int asciiReadCount = asciiStream.read(buffer,0,fileContentsLengthNumber[i].intValue());
zipOut.write(buffer, 0, fileContentsLengthNumber[i].intValue());
zipOut.closeEntry();
zipOut.close();
byte zipFileContents[] = new byte[zipFileBufferSize == 0 ? 100000000 : zipFileBufferSize];
FileInputStream zipIn = new FileInputStream(zipPathAndFileName);
int byteCount = zipIn.read(zipFileContents);
zipIn.close();
byte returnFileContents[] = new byte[byteCount];
System.arraycopy(zipFileContents,0,returnFileContents,0,byteCount);
String returnFileContentsString = new String(returnFileContents);
if (deleteZipFile)
boolean deletedFile = (new File(zipPathAndFileName)).delete();
oracle.sql.BLOB returnFileContentsBLOB = null;
returnFileContentsBLOB = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION);
returnFileContentsBLOB.open(BLOB.MODE_READWRITE);
//OutputStream tempBlobWriter = returnFileContentsBLOB.getBinaryOutputStream();
OutputStream tempBlobWriter = returnFileContentsBLOB.setBinaryStream(1);
tempBlobWriter.write(returnFileContents);
tempBlobWriter.flush();
tempBlobWriter.close();
returnFileContentsBLOB.close();
return returnFileContentsBLOB;
catch (IllegalArgumentException ex) {
ex.printStackTrace();
throw ex;
catch (FileNotFoundException ex) {
ex.printStackTrace();
throw ex;
catch (IOException ex)
ex.printStackTrace();
throw ex;
catch (java.sql.SQLException ex)
ex.printStackTrace();
throw ex;860411 wrote:
Hi Team,
I am unable to compile the java class in the SQL PLUS in dev1 and dev2. It is giving the following error.
But the same class get Compiled in the Toad(Tool) without any error and working fine. Could someone help me
What to do for this for your reference ,Attaching the java class file.
“ORA-29536: badly formed source: Encountered "<EOF>" at line 1, column 28.
Was expecting one of:
I believe the error message is clear and self-explanatory.
----------------------Here is the Java class Code.....................
create or replace and compile java source named "XXVM_ZipFileUtil_Ela"
as
import java.math.BigDecimal;
import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import oracle.sql.*;
import oracle.jdbc.*;
import java.sql.*;
import java.io.*;
public class XXVM_ZipFileUtil_Ela
public static oracle.sql.BLOB getZipFile(
oracle.sql.CHAR zipFilePathCHAR, oracle.sql.CHAR zipFileNameCHAR,
int fileBufferSize, int zipFileBufferSize,
boolean deleteZipFile, java.sql.Array fileNames, java.sql.Array fileContents, java.sql.Array fileContentsLength)
throws IllegalArgumentException, FileNotFoundException, IOException, java.sql.SQLException
String zipFilePath = (zipFilePathCHAR == null) ? null : zipFilePathCHAR.stringValue();
String zipFileName = (zipFileNameCHAR == null) ? null : zipFileNameCHAR.stringValue();
String zipPathAndFileName = new String(
new String(zipFilePath == null || zipFilePath == "" ? "/tmp/" : zipFilePath) +
new String(zipFileName == null || zipFileName == "" ? System.currentTimeMillis() + ".zip" : zipFileName));
byte[] buffer = new byte[fileBufferSize == 0 ? 100000000 : fileBufferSize];
try
Connection conn = DriverManager.getConnection("jdbc:default:connection:");
oracle.sql.CLOB[] fileContentsCLOB = (oracle.sql.CLOB[])fileContents.getArray();
String[] fileNamesString = (String[])fileNames.getArray();
BigDecimal[] fileContentsLengthNumber = (BigDecimal[])fileContentsLength.getArray();
ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipPathAndFileName));
zipOut.setLevel(Deflater.DEFAULT_COMPRESSION);
for (int i = 0; i < fileNamesString.length; i++) {
System.out.println(i);
zipOut.putNextEntry(new ZipEntry(fileNamesString));
InputStream asciiStream = fileContentsCLOB[i].getAsciiStream(1L);
int asciiReadCount = asciiStream.read(buffer,0,fileContentsLengthNumber[i].intValue());
zipOut.write(buffer, 0, fileContentsLengthNumber[i].intValue());
zipOut.closeEntry();
zipOut.close();
byte zipFileContents[] = new byte[zipFileBufferSize == 0 ? 100000000 : zipFileBufferSize];
FileInputStream zipIn = new FileInputStream(zipPathAndFileName);
int byteCount = zipIn.read(zipFileContents);
zipIn.close();
byte returnFileContents[] = new byte[byteCount];
System.arraycopy(zipFileContents,0,returnFileContents,0,byteCount);
String returnFileContentsString = new String(returnFileContents);
if (deleteZipFile)
boolean deletedFile = (new File(zipPathAndFileName)).delete();
oracle.sql.BLOB returnFileContentsBLOB = null;
returnFileContentsBLOB = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION);
returnFileContentsBLOB.open(BLOB.MODE_READWRITE);
//OutputStream tempBlobWriter = returnFileContentsBLOB.getBinaryOutputStream();
OutputStream tempBlobWriter = returnFileContentsBLOB.setBinaryStream(1);
tempBlobWriter.write(returnFileContents);
tempBlobWriter.flush();
tempBlobWriter.close();
returnFileContentsBLOB.close();
return returnFileContentsBLOB;
catch (IllegalArgumentException ex) {
ex.printStackTrace();
throw ex;
catch (FileNotFoundException ex) {
ex.printStackTrace();
throw ex;
catch (IOException ex)
ex.printStackTrace();
throw ex;
catch (java.sql.SQLException ex)
ex.printStackTrace();
throw ex;
The last two lines above should be
/Srini -
How to compile Oracle java strored procedure in Putty
I have created a java strored procedure , which would be invoked by oracle function.
This java stored procedure is get compiled via SQL plus. While compiling by the use of putty , it shows lots of compilation error .
How to compile Oracle java strored procedure in Putty??You'll need to add the j2ee.jar to your classpath. Usually you'll have to add some jars from your app server to your classpath as well.
For example (using weblogic):
javac -classpath c:\java\j2ee\j2ee1.3.1\lib\j2ee.jar;c:\tools\appserver\weblogic\wl7.1\lib\weblogic.jar
HelloServlet.java -
Than how can i get java class by using it's class file?
Hi
After compilation of a java program, it creates a class file.
After getting class file suppose class file has been deleted.
Than how can i get java class by using it's class file?
Thanks in advance.get a decompiler and run your class file through it--I'll assume you want the source code back and that you are not trying to recover a missing class file by attempting to use the class file that is missing--if it's missing, then I've not a clue on how to get it back by using what is already missing.
BTW: many of your compilers have source control--if it does, just restore your missing file. -
How to compile a java file which is in memory?
how to compile a java file which is in memory?
such as:
String s="class MyClass {....}";
how to compile the string?
thxcome on ...That was a perfectly valid solution.
Do you know how to call the sun.* compiler? If not then search the forums for it. If that interface still exists (which it might not in newer versions) you then will create a string stream from your class and pass it to that. -
How to compile a java file in J9 for windows mobile 5.0
I have downloaded J9 for windows mobile 5.0 and need help on how to compile a java file.
You can compile your source code using J2SE ;)
may be this is important for you:
http://awareness.ics.uci.edu/~rsilvafi/pocketPC/index.
html
Regards!!!Actually i am using some eSWT related classes also.. so is there any way to compile from the J9 environment using J9 console.. -
Workshop error during compilation of Java class
Hi,
I am starting to use Workshop for development. I am getting the following error when I start the debugger.
I am trying to compile a Java class and don't know how to proceed. Any help is appreciated.
build:
Deleting directory C:\DOCUME~1\name\LOCALS~1\Temp\wlw-temp-23835\wlw_compile55184
Created dir: C:\DOCUME~1\name\LOCALS~1\Temp\wlw-temp-23835\wlw_compile55184
C:\bea\user_projects\applications\CVXMLBeansApplication\CVXMLBeansClient\
ERROR: XMLBeansClient.java:12: The package of this type does not match its location on the source path: .
ERROR: 1 error(s), 0 warning(s).
BUILD FAILED
ERROR: Errors found.I found the answer nested in the documentation. I had to create folders that mirror the package structure and then place the source file in its appropriate folder.
-
Hi All,
I am extending a seeded CO and when I try to compile it in JDev , it asks for many class files the seeded CO imports.
I have copied all those imported files to my local system and when I try to compile , it still throws an error that some class files used by the classes imported in seeded CO are missing. Now this goes on and on. ( Seems entire server needs to be on my local system).
Now I decided to port the custom CO to server and compile it there. Even this seems to be a hard task for me as the javac command is not working on the server. It throws following exception
Exception in thread "main" java.lang.ClassFormatError: com.sun.tools.javac.main. Main (erroneous method access flags)......................................
Pls suggest how to compile a java file , as downloading entire server classes is a herculean task for me.
Thanks,
SrikanthHi Avajain & D.Ram ,
Thanks for the reply.
I have downloaded around 70 dependent class files to local system. Now the CO is getting compiled correctly.
I am extending a region level controller in Payroll page where in I have to default the salary to a predefined value.
This field is having a VO attribute to it. Now can I go ahead and set a value to the MessageTextInput or should I extend the VO to replace the desired value in the place of already queried value.
Thanks,
Srikanth -
How to call a Java class from another java class ??
Hi ..... can somebody plz tell me
How to call a Java Class from another Java Class assuming both in the same Package??
I want to call the entire Java Class (not any specific method only........I want all the functionalities of that class)
Please provide me some slotuions!!
Waiting for some fast replies!!
Regards
Smita MohantyHi Smita,
you just need to create an object of that class,thats it. Then you will be able to execute each and every method.
e.g.
you have developed A.java and B.java, both are in same package.
in implementaion of B.java
class B
A obj = new A();
//to access A's methods
A.method();
// to access A's variable
//either
A.variable= value.
//or
A.setvariable() or A.getvariable() -
How to use a java class in difference project under a same workspace!
Hi, there:
I have a problem. I want to reuse a java class which is located in another project of the same workspace. I do not know how to set the two project setting or how to import the java class. I deeply appreciate.
Sheng-Heinclude it as a library
open project settings goto libraries and simply add your class -
How to compile a java file(Servlet) in J2EE v1.3.1
This is my first time using J2EE instead of J2SE!!HOw to compile a java file in J2ee\bin because there is no javac in j2ee and when i compile in J2se i got
G:\j2sdk1.4.1_01\bin>javac HelloServlet.java
HelloServlet.java:2: package javax.servlet does not exist
import javax.servlet.*;
This mean it doen;t support servlet in J2se!!so how can /what command to compile a servlet java file in j2ee.ThanksYou'll need to add the j2ee.jar to your classpath. Usually you'll have to add some jars from your app server to your classpath as well.
For example (using weblogic):
javac -classpath c:\java\j2ee\j2ee1.3.1\lib\j2ee.jar;c:\tools\appserver\weblogic\wl7.1\lib\weblogic.jar
HelloServlet.java -
How to compile a java source from a java program
Hi .
I would like to know how to compile my java source from inside an execution of a java program.
Is there another way than rather use :
Runtime.getRuntime().exec("javac myFile"); ?you can and cann't use the source code of javac... or maybe use jikes...
-
How to compile a java file to class with class
There is a java file.
And i want to compile it with class, not javac command.
so i can catch the compile errors.
how to do it?
special thanks.http://java.sun.com/developer/JDCTechTips/2003/tt0722.html#2
-
How to import a java class in a JSP
Hi All,
I have a java class file called myTest.class (i made after compilation of myTest.java). I have a JSP page that uses this java class file.
These 2 files are in same folder called c:/test
and iam importing this java class file into my jsp file and that too at the start of this jsp file:
<%@page import="myTest" %>
BUt iam getting an error ..............when iam running this JSP page:
/opt/bea81sp2/user_projects/domains/wliDomain/./Managed2/.wlnotdelete/extract/Managed2_myTest_myTest/jsp_servlet/__test.java:20: '.' expected
probably occurred due to an error in /test.jsp line 5:
<%@page import="myTest" %>
Please advise how to solve this problem
-sangitaDon't bother with the import
when iam not importing this class file into my JSP, then on my JSP, the class file is not found.
Here is my code: and these 2 class file are in c:/test
import org.apache.tools.ant.taskdefs.Ant;
import org.apache.tools.ant.taskdefs.Property;
import org.apache.tools.ant.types.*;
import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.ExecTask;
import org.apache.tools.ant.types.Commandline;
import java.io.File;
* Creates an Ant project to run an Ant build
* @author myself
* @version 1.0
public class RunTest extends Ant {
String applicationName;
String buttonClicked;
String boxName;
String targetName;
public void applicationName(String applicationName){
this.applicationName = applicationName;
public void boxName(String boxName){
this.boxName = boxName;
public void buttonClicked(String buttonClicked){
this.buttonClicked = buttonClicked;
public RunTest() {
public void goTest() {
if(this.buttonClicked.equalsIgnoreCase("deploy") && this.applicationName.equalsIgnoreCase("scsmail") && this.boxName.equalsIgnoreCase("testnet")){
this.targetName = "deploy-scsmail-testnet";
if(this.buttonClicked.equalsIgnoreCase("undeploy") && this.applicationName.equalsIgnoreCase("scsmail") && this.boxName.equalsIgnoreCase("testnet")){
this.targetName = "undeploy-scsmail-testnet";
Project project = new Project();
project.init();
System.out.println("printing 1 ....");
ExecTask exec = new ExecTask();
exec.setProject(project);
exec.setExecutable("/opt/bea/weblogic81/server/bin/ant.bat");
exec.setDir(new java.io.File("/export/home/beamon/bin"));
Commandline.Argument arg = exec.createArg();
// arg.setLine("-f scsmail.xml test -listener org.apache.tools.ant.XmlLogger -logfile D:/antProject/src/log.xml");
arg.setLine("-f build.xml "+ targetName + " -listener org.apache.tools.ant.XmlLogger -logfile /export/home/beamon/bin/log.xml");
System.out.println("printing 2....");
//exec.setOutput(new File("D:/antProject/logs/prob.txt"));
exec.execute();
System.out.println("printing 3....");
-----------------------the JSP page is called as test.jsp
<%@page contentType="text/html" %>
<%@page import="java.io.*" %>
<%@page import="java.util.*" %>
<%@page import="java.net.*" %>
<%@page import="RunTest" %>
<HTML>
<TITLE>TESTING ANT GUI</TITLE>
<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="3000" >
<meta http-equiv="Cache-Control" content="no-cache">
</HEAD>
<BODY BGCOLOR="silver" TEXT="333333">
<table border=0>
<tr align="left"><td align="left"><FONT SIZE="-1"><B> Test Page <FONT SIZE="-1"><B></td></tr>
</table>
<hr></center>
<form action="./test.jsp" method="POST" name="testForm">
<table>
<tr>
<td>
<select name="appName" size=1>
<option value="">Select Application Name
<option value="scsmail">scsMail
<option value="clientmanager">ClientManager
</select>
</td>
<td>
<select name="boxName" size=1>
<option value="">Select Box Name
<option value="testnet">TestNet
<option value="production">Production
</select>
</td>
</table>
<table>
<input type="submit" name="deploy" value="deploy">
<input type="submit" name="undeploy" value="undeploy">
</table>
<%
RunTest rt = new RunTest();
rt.applicationName(request.getParameter("appName"));
String deployButton = "";
deployButton=request.getParameter("deploy");
String undeployButton = "";
undeployButton=request.getParameter("undeploy");
if(!deployButton.equalsIgnoreCase("")){
rt.buttonClicked(request.getParameter("deployButton"));
if(!undeployButton.equalsIgnoreCase("")){
rt.buttonClicked(request.getParameter("undeployButton"));
rt.boxName(request.getParameter("boxName"));
rt.goTest();
%>
</form>
</table>
</BODY>
</HTML>
Maybe you are looking for
-
Recording from webcam into fcp
Can you record video from a web cam directly into FCP?
-
Is there a way to quickly delete 150 emails?
iis there a quick way to delete 150 emails?
-
Problem when engineering to relational model
I have modeled everything in Logical model and then engineered it to the relational model. Now I have to make some changes, and I'm doing them in Logical model. When I'm engineering it to Relational, although I just altered one single item, I see tha
-
[soleved]Can't figure out why iptables rules aren't enforced
My iptables rules are not enforced. I recently reinstalled, and I'm re-using the same /etc/iptables/iptables.rules. They used to work, I tested them, but they don't seem to work anymore. Here are the contents of my /etc/iptables/iptables.rules: # G
-
How do I set up the Table of contents so the << and >> buttons are available and also the Back button on all inquiries?