MKDIR in Java...
Hi all...,
I'm trying to simulate the MKDIR in java. But it doesn't work properly.
My coding looks as follows.
class MkdirTest{
String path="D:\\New\\Test1\\Test2\\Test3";
public boolean tryMkdir(){
boolean status = new File(path).mkdir();
return status;
public static void main(String args[]){
MkdirTest myTest = new MkdirTest();
System.out.println("Success status of creating folder structure : "+myTest .tryMkdir());
}Can someone please tell me why...??? Coz when I try D:\>mkdir New\Test1\Test2\Test3 @ command prompt, it works just fine.
Thanx in advance,
Asela.
But it doesn't work properly.Why not? Could you say what the output is when you run this program. It is especially important whether (or not) there are any exceptions thrown.
mkdir() will fail if the parent directory (D:\New\Test1\Test2) does not already exist. mkdirs() doesn't have this problem.
Similar Messages
-
Exported ant script -- NoClassDefFound?
I've exported ant script from workshop (wls9.2 eclipse) and I was able to build the app.war (web services) ok.
However I saw message like this:
"assembly: Imput fileset contained no files, nothing to do."
And when I deployed the war to server and tried to access the webservices, it gave me NoClassDefFound error.
Also I noticed that the ".staging" directory has empty "lib" dir under it.
Does anyone know how to fix it?
Here is the generated build.xml and workspace.xml.
========================= workspace.xml==============
<?xml version="1.0" encoding="UTF-8"?>
<node name="metadata">
<node name="projects">
<node name="billingservice">
<attribute name="location" value="C:/home/rlee/projects/telepacific/billingservice"/>
</node>
</node>
<node name="library-modules">
<node name="library-module">
<attribute name="location" value="%wl.home%/common/deployable-libraries/wls-commonslogging-bridge.war"/>
</node>
<node name="library-module">
<attribute name="location" value="%wl.home%/common/deployable-libraries/weblogic-controls-1.0.war"/>
</node>
<node name="library-module">
<attribute name="location" value="%wl.home%/common/deployable-libraries/beehive-controls-1.0.war"/>
</node>
</node>
<node name="server-runtimes">
<node name="BEA WebLogic v9.2">
<attribute name="location" value="%wl.home%"/>
</node>
</node>
<node name="vm-locations">
<attribute name="defaultVM" value="C:/bea/wls922/jdk150_10"/>
<node name="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/BEA WebLogic v9.2 JRE">
<attribute name="location" value="c:/bea/wls922/jrockit90_150_10"/>
</node>
</node>
<node name="classpath-vars">
<node name="SDKS_HOME">
<attribute name="value" value="c:/home/rlee/projects/mpower/sdks"/>
</node>
<node name="WEBLOGIC_HOME">
<attribute name="value" value="%wl.home%"/>
</node>
</node>
</node>
======================= end of workspace.xml==============
==================== exported build.xml ====================
<project default="build">
<description>
Project build script. All public targets require the "workspace" property to be
set at invocation. It can either point at the Eclipse workspace directory that
this project belongs to or an exported workspace.xml file. The wl.home property
may also need to be specified unless WL_HOME environment variable is defined.
</description>
<target name="init.env" unless="init.env.executed">
<property name="init.env.executed" value="true"/>
<property environment="env"/>
<condition property="wl.home" value="${env.WL_HOME}">
<isset property="env.WL_HOME"/>
</condition>
<fail unless="wl.home" message="The wl.home property needs to be set!"/>
</target>
<target name="init.typedefs" depends="init.env" unless="init.typedefs.executed">
<property name="init.typedefs.executed" value="true"/>
<typedef resource="com/bea/wlw/antlib/antlib.xml">
<classpath>
<fileset dir="${wl.home}">
<include name="workshop/lib/wlw-antlib.jar"/>
<include name="workshop/lib/wlw-util.jar"/>
<include name="workshop/lib/wlw-libmodules.jar"/>
<include name="workshop/lib/wlw-splitsrc.jar"/>
<include name="server/lib/ant/ant-contrib-1.0b1.jar"/>
</fileset>
</classpath>
</typedef>
</target>
<target name="init" depends="init.env,init.typedefs" unless="init.executed">
<property name="init.executed" value="true"/>
<fail unless="workspace" message="The workspace property needs to be set!"/>
<dirname property="project.dir" file="${ant.file}"/>
<property name="echo.metadata" value="false"/>
<mdimport workspace="${workspace}" pjdir="${project.dir}" echo="${echo.metadata}">
<option name="skipAnnotationProcessors" value="com.bea.wlw.webservices.core"/>
</mdimport>
<property name="archive.name" value="${project.name}.war"/>
<property name="uri" value="${archive.name}"/>
<taskdef name="xmlbean"
classname="org.apache.xmlbeans.impl.tool.XMLBean">
<classpath>
<pathelement path="${wl.home}/common/lib/apache_xbean.jar"/>
<pathelement path="${wl.home}/common/eclipse/plugins/com.bea.eclipse.common.lib.apache_xbean2/jsr173_api.jar"/>
</classpath>
</taskdef>
<property name="generated.module.root" value="${project.dir}/build/weboutput"/>
<property name="assembly.src" value="${project.dir}/build/assembly/.src"/>
</target>
<target name="build" depends="init" description=" compiles the source files; does not package the results">
<for list="0,1,2,3,4,5,6,7,8,9" param="i">
<sequential>
<if>
<and>
<isset property="xbean.src.@{i}.dir"/>
<available file="${xbean.src.@{i}.dir}"/>
</and>
<then>
<fileset id="xbean.src.paths.@{i}"
dir="${xbean.src.@{i}.dir}"
includes="${xbean.src.@{i}.include}"
excludes="${xbean.src.@{i}.exclude}"/>
</then>
<else>
<fileset id="xbean.src.paths.@{i}"
file="null_file_set"/>
</else>
</if>
</sequential>
</for>
<if>
<isset property="xbean.include-classpath-contributions"/>
<then>
<path id="xbean.classpath">
<path refid="java.classpath"/>
</path>
</then>
<else>
<path id="xbean.classpath">
<pathelement location="${wl.home}/common/lib/apache_xbean.jar"/>
</path>
</else>
</if>
<mkdir dir="${xbean.src.output.dir}"/>
<mkdir dir="${xbean.bin.output.dir}"/>
<xmlbean
javasource="${xbean.java-version}"
download="${xbean.download-network-urls}"
typesystemname="${xbean.schema-type-name}"
noupa="${xbean.unique-particle-attribution}"
nopvr="${xbean.particle-valid-restriction}"
noannotations="${xbean.skip-annotations}"
ignoreDuplicatesInNamespaces="${xbean.namespaces-to-ignore-dups}"
srcgendir="${xbean.src.output.dir}"
classgendir="${xbean.bin.output.dir}"
classpathref="xbean.classpath"
srconly="true">
<fileset refid="xbean.src.paths.0"/>
<fileset refid="xbean.src.paths.1"/>
<fileset refid="xbean.src.paths.2"/>
<fileset refid="xbean.src.paths.3"/>
<fileset refid="xbean.src.paths.4"/>
<fileset refid="xbean.src.paths.5"/>
<fileset refid="xbean.src.paths.6"/>
<fileset refid="xbean.src.paths.7"/>
<fileset refid="xbean.src.paths.8"/>
<fileset refid="xbean.src.paths.9"/>
</xmlbean>
<if>
<isreference refid="apt.factory.path"/>
<then>
<mkdir dir="${apt.src.output.dir}"/>
<for-each-java-src-path>
<if>
<available file="${.java.src.dir}"/>
<then>
<mkdir dir="${.java.src.output}"/>
<apt
sourcepath="${java.sourcepath}"
srcdir="${.java.src.dir}"
includes="${.java.src.include}"
excludes="${.java.src.exclude}"
destdir="${.java.src.output}"
preprocessdir="${apt.src.output.dir}"
classpathref="java.classpath"
factorypathref="apt.factory.path"
options="${apt.options}"
compile="false"/>
</then>
</if>
</for-each-java-src-path>
</then>
</if>
<for-each-java-src-path>
<if>
<available file="${.java.src.dir}"/>
<then>
<mkdir dir="${.java.src.output}"/>
<javac
sourcepath="${java.sourcepath}"
srcdir="${.java.src.dir}"
includes="${.java.src.include}"
excludes="${.java.src.exclude}"
destdir="${.java.src.output}"
classpathref="java.classpath"
debug="on"/>
</then>
</if>
</for-each-java-src-path>
<delete dir="${generated.module.root}"/>
<mkdir dir="${generated.module.root}"/>
<resolve-path property="user.web.xml" path="WEB-INF/web.xml"/>
<resolve-path property="user.weblogic.xml" path="WEB-INF/weblogic.xml"/>
<copy todir="${generated.module.root}/WEB-INF" file="${user.web.xml}" />
<copy todir="${generated.module.root}/WEB-INF" file="${user.weblogic.xml}" failonerror="false" />
</target>
<target name="clean" depends="init" description=" removes the files and directories generated by the build target">
<if>
<available file="${xbean.src.output.dir}"/>
<then>
<delete includeEmptyDirs="true">
<fileset dir="${xbean.src.output.dir}" includes="**/*"/>
</delete>
</then>
</if>
<if>
<available file="${xbean.bin.output.dir}"/>
<then>
<delete includeEmptyDirs="true">
<fileset dir="${xbean.bin.output.dir}" includes="**/*"/>
</delete>
</then>
</if>
<if>
<available file="${apt.src.output.dir}"/>
<then>
<delete includeEmptyDirs="true">
<fileset dir="${apt.src.output.dir}" includes="**/*"/>
</delete>
</then>
</if>
<for-each-java-src-path>
<if>
<available file="${.java.src.output}"/>
<then>
<if>
<equals arg1="${.java.src.dir}" arg2="${.java.src.output}"/>
<then>
<delete includeEmptyDirs="true">
<fileset dir="${.java.src.output}">
<or>
<filename name="**/*.class"/>
<and>
<type type="dir"/>
<depth min="0"/>
</and>
</or>
</fileset>
</delete>
</then>
<else>
<delete includeEmptyDirs="true">
<fileset dir="${.java.src.output}" includes="**/*"/>
</delete>
</else>
</if>
</then>
</if>
</for-each-java-src-path>
<delete dir="${assembly.src}"/>
<delete dir="${generated.module.root}"/>
<mkdir dir="${generated.module.root}"/>
</target>
<target name="assemble" depends="init" description=" assembles the project for iterative dev deployment; requires that the "ear.root" property is specified">
<property name="prefix" value=""/>
<for-each-resource-path>
<link ear="${ear.root}" source="${.resource.path}" target="${prefix}${uri}/${.resource.prefix}"/>
</for-each-resource-path>
<!-- Link in referenced utility projects into the WEB-INF/lib directory. -->
<for-each-referenced-component>
<if>
<and>
<equals arg1="${.referenced.component.type}" arg2="project"/>
<equals arg1="${.referenced.component.target.path}" arg2="WEB-INF/lib"/>
</and>
<then>
<antex
antfile="${.referenced.component.handle}/build.xml"
dir="${.referenced.component.handle}"
target="assemble"
inheritUserProps="false"
inheritAll="false"
inheritRefs="false">
<property name="wl.home" value="${wl.home}"/>
<property name="patch.home" value="${patch.home}"/>
<property name="workspace" value="${workspace}"/>
<property name="init.typedefs.executed" value="true"/>
<property name="ear.root" value="${ear.root}"/>
<property name="prefix" value="${uri}/WEB-INF/lib/"/>
</antex>
</then>
</if>
</for-each-referenced-component>
<link ear="${ear.root}" source="${xbean.bin.output.dir}" target="${link.target}"/>
<link ear="${ear.root}" source="${generated.module.root}" target="${uri}"/>
<antcall target="assembly" inheritAll="true" inheritRefs="true" >
<param name="ear.root" value="${ear.root}"/>
</antcall>
<antcall target="webservice.build" inheritAll="true" inheritRefs="true" />
</target>
<target name="stage" depends="init" description=" copies all of project's resources and build artifacts into a form that's ready for archive creation; staging directory can be overridden via the "staging.dir" property">
<antcall target="assembly" inheritAll="true" inheritRefs="true" >
<param name="ear.root" value="${ear.staging.dir}"/>
</antcall>
<antcall target="webservice.build" inheritAll="true" inheritRefs="true" />
<property name="staging.dir" value="${project.dir}/.staging"/>
<delete dir="${staging.dir}" quiet="true"/>
<mkdir dir="${staging.dir}"/>
<for-each-resource-path>
<if>
<available file="${.resource.path}"/>
<then>
<if>
<isfile path="${.resource.path}"/>
<then>
<copy file="${.resource.path}" tofile="${staging.dir}/${.resource.prefix}"/>
</then>
<else>
<copy todir="${staging.dir}/${.resource.prefix}">
<fileset dir="${.resource.path}" includes="${.resource.include}" excludes="${.resource.exclude}"/>
</copy>
</else>
</if>
</then>
</if>
</for-each-resource-path>
<!-- Packaged referenced utility projects into the WEB-INF/lib directory. -->
<property name="webinflib" value="${staging.dir}/WEB-INF/lib"/>
<mkdir dir="${webinflib}"/>
<for-each-referenced-component>
<if>
<and>
<equals arg1="${.referenced.component.type}" arg2="project"/>
<equals arg1="${.referenced.component.target.path}" arg2="WEB-INF/lib"/>
</and>
<then>
<antex
antfile="${.referenced.component.handle}/build.xml"
dir="${.referenced.component.handle}"
target="archive"
inheritUserProps="false"
inheritAll="false"
inheritRefs="false">
<property name="wl.home" value="${wl.home}"/>
<property name="patch.home" value="${patch.home}"/>
<property name="workspace" value="${workspace}"/>
<property name="init.typedefs.executed" value="true"/>
<property name="archive.dir" value="${webinflib}"/>
</antex>
</then>
</if>
</for-each-referenced-component>
<copy todir="${staging.dir}/${xbean.deploy.prefix}">
<fileset dir="${xbean.bin.output.dir}"/>
</copy>
<if>
<available file="${generated.module.root}"/>
<then>
<copy todir="${staging.dir}" overwrite="true">
<fileset dir="${generated.module.root}"/>
</copy>
</then>
</if>
<taskdef name="build-manifests"
classname="weblogic.ant.taskdefs.build.AnnotationManifestTask"
onerror="fail" />
<path id="annotation.manifest.search.path">
<fileset dir="${staging.dir}">
<include name="WEB-INF/lib/*.jar"/>
</fileset>
<pathelement location="${staging.dir}/WEB-INF/classes"/>
</path>
<path id="annotation.manifest.class.path">
<path refid="annotation.manifest.search.path"/>
<path refid="java.classpath"/>
</path>
<build-manifests moduleDir="${staging.dir}"
searchClasspathRef="annotation.manifest.search.path"
classpathRef="annotation.manifest.class.path"
verbose="true"
version=""
stagingDir="${java.io.tmpdir}/.manifest"/>
</target>
<target name="archive" depends="stage" description=" creates an archive containing all projects's resources and build artifacts; archive name and location can be overridden via the "archive.path" property">
<property name="archive.dir" value="${project.dir}"/>
<mkdir dir="${archive.dir}"/>
<zip destfile="${archive.dir}/${archive.name}" encoding="UTF8" whenempty="create">
<fileset dir="${staging.dir}"/>
</zip>
</target>
<target name="stage.to.ear" depends="init">
<property name="prefix" value=""/>
<antcallex target="archive" inheritUserProps="false" inheritAll="false" inheritRefs="false">
<param name="wl.home" value="${wl.home}"/>
<param name="patch.home" value="${patch.home}"/>
<param name="workspace" value="${workspace}"/>
<param name="init.typedefs.executed" value="true"/>
<param name="archive.dir" value="${ear.staging.dir}${prefix}"/>
<param name="ear.staging.dir" value="${ear.staging.dir}"/>
</antcallex>
</target>
<target name="generated.root.init" depends="init">
<property name="generated.module.root" value="${project.dir}/build/weboutput"/>
</target>
<target name="assembly" depends="init,generated.root.init">
<taskdef name="assemble"
classname="com.bea.control.assembly.AssembleTask"
classpathref="java.classpath"
onerror="report" />
<property name="assembly.src.output" value="${java.src.0.output}"/>
<mkdir dir="${assembly.src}"/>
<path id="assembly.classpath">
<path refid="java.classpath" />
<pathelement location="${assembly.src.output}" />
<pathelement path="${java.outpath}" />
<pathelement path="${java.sourcepath}"/>
</path>
<assemble
moduleDir="${generated.module.root}"
moduleName="${project.name}"
srcOutputDir="${assembly.src}"
appRootDir="${ear.root}">
<assemblyContext factory="org.apache.beehive.controls.runtime.assembly.WebAppAssemblyContext$Factory" />
<assemblyContext factory="org.apache.beehive.controls.runtime.assembly.AppAssemblyContext$Factory" />
<classpath refid="assembly.classpath" />
<fileset dir="${project.dir}">
<include name="**/*.controls.properties" />
</fileset>
</assemble>
<apt
srcdir="${assembly.src}"
preprocessdir="${apt.src.output.dir}"
factorypathref="apt.factory.path"
options="${apt.options}"
compile="false">
<classpath refid="assembly.classpath" />
</apt>
<javac
srcdir="${assembly.src}"
destdir="${assembly.src.output}"
debug="on">
<classpath refid="assembly.classpath" />
</javac>
</target>
<target name="webservice.build" depends="init,generated.root.init">
<path id="jwsc.srcpath">
<path path="${java.sourcepath}" />
<pathelement path="build/assembly/.src" />
</path>
<taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask" />
<property name="jwsc.module.root" value="${project.dir}/build/weboutput"/>
<property name="jwsc.contextpath" value="billingservice"/>
<property name="jwsc.srcpath.prop" refid="jwsc.srcpath"/>
<path id="jwsc.classpath">
<path refid="java.classpath" />
<pathelement path="${java.outpath}" />
</path>
<jwsc
destdir="${project.dir}/build"
classpathref="jwsc.classpath"
>
<module name="weboutput" explode="true" contextPath="${jwsc.contextpath}">
<jwsFileSet srcdir="${jwsc.srcpath.prop}">
<include name="**/*.java"/>
</jwsFileSet>
<descriptor file="${jwsc.module.root}/WEB-INF/web.xml" />
<descriptor file="${jwsc.module.root}/WEB-INF/weblogic.xml" />
</module>
</jwsc>
</target>
</project>
==================== end of exported build.xml =========
Thanks!
Edited by renqili at 08/09/2007 10:52 AMIt looks a bug to me. The exported ant script does not take care the jar files setup in the classpath in workshop/eclipes and copy them to the WEB-INFO/lib directory.
-
Creating directories in a remote machine.
Hi all,
Is there any way to create directories in remote machines?
I'm sending files from a server machine to a client machine.
Now I'm just sending them in bytes and writing them in the client in a file already created.
Please help me to dynamically create files and directories in the client machine.
Thanks in advance.hi,
u can pass the Directories list (or path)and then create them there using mkdir() and mkdirs().
refer java.io.File in API.
can u suggest me a way to do this?
I am working in a project where i need to get files from a folder present in local drives or from a shared folder in some other machine connected in the LAN
I'm having problem with accessing files in a shared folder i.e., I'm getting Null Pointer Exception.Should the folder be considered as a file in a remotehost and that host be connected with my machine?
Is there anyway to do this? -
Rename, New folder action using Drive CMIS connector
I am trying to work on "Rename" and "New Folder" actions from Drive. To give more details - when I connect to our DAM using Drive, the DAM gets mounted as a network drive and can be accessed from Windows Explorer. I was told on one of the Adobe forums thread that Drive uses the Windows in-built context menus to initiate these actions.
Refer: http://forums.adobe.com/message/3807568#3807568
But when I try "New Folder" menu, Explorer gives me "Access denied" or "You need permission" kind of error. On "Rename" I get similar error. I believe both these errors are due to the fact that I am trying to modify certain things on a network drive. But then what would be the work around so that I can perform these actions on a CMIS server using Drive?
We are adding CMIS layer on top of our DAM so that it will work as a CMIS server. For connection with Drive, we use the default CMIS connector that comes with it.Logs on "Rename" action
2012/09/28 05:34:58,691 [IFSConnection-1] FATAL IFSConnection - NASTY Runtime exception for Request: RENAME
com.adobe.drive.biz.filesystem.FileSystemException: java.lang.NullPointerException
at com.adobe.drive.internal.biz.filesystem.FileSystemService.run(FileSystemService.java:1680 )
at com.adobe.drive.internal.biz.filesystem.FileSystemService.run(FileSystemService.java:1646 )
at com.adobe.drive.internal.biz.filesystem.FileSystemService.rename(FileSystemService.java:9 81)
at com.adobe.drive.ifs.job.RenameHandler$1.call(RenameHandler.java:95)
at com.adobe.drive.ifs.job.RenameHandler$1.call(RenameHandler.java:1)
at com.adobe.drive.model.context.Context.run(Context.java:88)
at com.adobe.drive.ifs.internal.IFSConnection.dispatch(IFSConnection.java:187)
at com.adobe.drive.ifs.internal.IFSConnection.run(IFSConnection.java:142)
Caused by: java.lang.NullPointerException
at com.adobe.drive.connector.cmis.client.CMISProxy.buildQuery(CMISProxy.java:2086)
at com.adobe.drive.connector.cmis.client.CMISProxy.query(CMISProxy.java:1987)
at com.adobe.drive.connector.cmis.client.CMISProxy.getDescendantDocuments(CMISProxy.java:196 1)
at com.adobe.drive.connector.cmis.client.CMISProxy.hasCheckedOutDocumentsByAnyUser(CMISProxy .java:1920)
at com.adobe.drive.connector.cmis.handler.Handler.isCheckedOut(Handler.java:305)
at com.adobe.drive.connector.cmis.handler.MoveHandler.execute(MoveHandler.java:95)
at com.adobe.drive.connector.cmis.handler.MoveHandler.execute(MoveHandler.java:1)
at com.adobe.drive.internal.data.manager.DataManager.execute(DataManager.java:3162)
at com.adobe.drive.internal.data.manager.DataManager.execute(DataManager.java:3114)
at com.adobe.drive.data.manager.call.AbstractFSCall.executeConnector(AbstractFSCall.java:323 )
at com.adobe.drive.data.manager.call.Move.callConnector(Move.java:501)
at com.adobe.drive.data.manager.call.Move.moveRemoteSource(Move.java:302)
at com.adobe.drive.data.manager.call.MoveFinder.moveToEmptyDestination(MoveFinder.java:83)
at com.adobe.drive.data.manager.call.MoveExplorer.moveToEmptyDestination(MoveExplorer.java:7 0)
at com.adobe.drive.data.manager.call.Move.execute(Move.java:142)
at com.adobe.drive.internal.data.manager.DataManager.moveAsset(DataManager.java:3892)
at com.adobe.drive.internal.biz.filesystem.FileSystemService$12.execute(FileSystemService.ja va:998)
at com.adobe.drive.internal.biz.filesystem.FileSystemService$FSRunnable.run(FileSystemServic e.java:1803)
at com.adobe.drive.data.internal.persistence.PersistenceRunner.run(PersistenceRunner.java:11 9)
at com.adobe.drive.internal.biz.filesystem.FileSystemService.run(FileSystemService.java:1666 )
... 7 more
Logs on "New folder" action
2012/09/28 05:23:42,321 [IFSConnection-1] FATAL IFSConnection - NASTY Runtime exception for Request: CREATE
com.adobe.drive.biz.filesystem.FileSystemException: com.adobe.drive.data.model.DriveException: Error creating directory
at com.adobe.drive.internal.biz.filesystem.FileSystemService.wrapException(FileSystemService .java:1623)
at com.adobe.drive.internal.biz.filesystem.FileSystemService.run(FileSystemService.java:1673 )
at com.adobe.drive.internal.biz.filesystem.FileSystemService.create(FileSystemService.java:8 67)
at com.adobe.drive.ifs.job.CreateHandler$1.mkDir(CreateHandler.java:204)
at com.adobe.drive.ifs.job.CreateHandler$1.call(CreateHandler.java:183)
at com.adobe.drive.ifs.job.CreateHandler$1.call(CreateHandler.java:1)
at com.adobe.drive.model.context.Context.run(Context.java:88)
at com.adobe.drive.ifs.internal.IFSConnection.dispatch(IFSConnection.java:187)
at com.adobe.drive.ifs.internal.IFSConnection.run(IFSConnection.java:142)
Caused by: com.adobe.drive.data.model.DriveException: Error creating directory
at com.adobe.drive.internal.data.manager.DataManager.create(DataManager.java:4434)
at com.adobe.drive.internal.biz.filesystem.FileSystemService$10.execute(FileSystemService.ja va:885)
at com.adobe.drive.internal.biz.filesystem.FileSystemService$10.execute(FileSystemService.ja va:1)
at com.adobe.drive.internal.biz.filesystem.FileSystemService$FSCallable.run(FileSystemServic e.java:1767)
at com.adobe.drive.data.internal.persistence.PersistenceRunner.run(PersistenceRunner.java:11 9)
at com.adobe.drive.internal.biz.filesystem.FileSystemService.run(FileSystemService.java:1666 )
... 7 more
There might be something wrong with our implementation as well. But I am not able to figure out where lies the problem. -
Security Manager refused file access
I am using javax.mail API(1.2), bundled with the j2ee package, for an automated email generation of user registration,and getting the following exception
access denied (java.io.FilePermission /web/tomcat/work/hosting/www.newringmedia.com/_/loader/META-INF write)
The full stack trace is
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
java.security.AccessController.checkPermission(AccessController.java:427)
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
java.io.File.mkdir(File.java:1119)
java.io.File.mkdirs(File.java:1148)
org.apache.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:1811)
org.apache.catalina.loader.WebappClassLoader.findResource(WebappClassLoader.java:920)
org.apache.catalina.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1138)
java.lang.Class.getResourceAsStream(Class.java:1998)
javax.mail.Session.loadProviders(Session.java:793)
javax.mail.Session.(Session.java:81)
javax.mail.Session.getInstance(Session.java:103)
website.Email.sendThanksToUser(Email.java:37)
blah
blah
blah
My site is designed using jsp, and is deployed on GoDaddy.com
It uses a shared server instance (tomcat 5.0.27)
All other smtp configurations are fine, I 've tested them on my local server.
Some body Pls Helporg.apache.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:1811)The above line from the trace appears to be trying to create some directories File.mkdirs()
Why is that?
Following up the stack trace, the attempted creation fails?
Sorry, I have no idea why? -
Weblogic.ejbc wants weblogic.home sysproperty in ant - why
I found that I had to add the following 'sysproperty' line to an ant target which
runs weblogic.ejbc:
<target name="ejbjar" depends="jar">
<mkdir dir="${java.class.dir}/${package.dir}/tmp"/>
<java classname="weblogic.ejbc" fork="true" failonerror="true">
<sysproperty key="weblogic.home" value="c:/bea70/weblogic700/server"/>
<classpath>
<path refid="classpathWL"/>
</classpath>
<arg line="${java.class.dir}/${archive}.jar ${java.class.dir}/ejb-${archive}.jar"/>
</java>
</target>
If the line is not there I get an error:
[java] ERROR: Error from ejbc: error in finding weblogic.Home
If the line is there and points to an invalid weblogic.home directory the error is:
[java] ERROR: Error from ejbc: Installation file c:\temp\lib\persistence\persistence.install
does not exist. Could not initialize EJB container managed persistence.
However the file contains only one line:
WebLogic_CMP_RDBMS.xml.
Question: is there a way to specify this value directly to weblogic.ejbc without
the look-up to the file? In my case I would like to do a build on a machine where
weblogic is not installed (but of course weblogic.jar is available). It is trivial
to add the file to the FS somewhere but why bother?here is my Ant target looks like...
<property name="classpath" value="${lib.ext.dir}/j2ee12.jar;${lib.ext.dir}/weblogic.jar;${lib.ext.dir}/log4j-1.2.9.jar;${lib.ext.dir}/struts.jar;${dest.dir}/${ant.project.name}.jar"/>
<target name="testjar">
<javac srcdir="${src.dir}" destdir="${ejbc.dir}" classpath="${classpath}"/>
<ejbjar srcdir="${dest.dir}" descriptordir="${desc.dir}" basejarname="test" classpath="${classpath}">
<weblogic destdir="${lib.dir}" classpath="${classpath}" oldCMP="false"/>
<include name="**/ejb-jar.xml" />
<exclude name="**/weblogic*.xml" />
<dtd publicid="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" location="${lib.dir}/dtd/ejb20-jar.dtd"/>
<dtd publicid="-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN" location="${lib.dir}/dtd/weblogic-ejb-jar.dtd"/>
</ejbjar>
</target>
I a not sure where to specify <sysproperty....>
Please revert back if u know the answer. -
Hi all
I've installed R12.1.1 on OEL 5u4, and it's all working correctly.
However, I can't work out what's required to launch the professional forms on Linux. I need to install the J2SE Plugin version 1.6.0_07.
Can anyone help out with what's needed?
ThanksOutput below:
[oracle@alard12 ~]$ grep sun_plugin_ver $CONTEXT_FILE
<sun_plugin_ver oa_var="s_sun_plugin_ver">1.6.0_07</sun_plugin_ver>
I installed jre-6u7-linux-i586-rpm.bin as follows:
# mkdir /usr/java
# cd /usr/java
# sh jre-6u7-linux-i586-rpm.bin
This competed successfully. I then created the soft link as follows:
cd /usr/lib/mozilla/plugins
ln -s /usr/java/jre1.6.0_07/plugin/i386/ns7/libjavaplugin_oji.so
about:plugins shows:
Installed plugins
Find more information about browser plugins at mozilla.org.
Help for installing plugins is available from plugindoc.mozdev.org.
Shockwave Flash
File name: nswrapper_32_32.libflashplayer.so
Shockwave Flash 10.0 r32
MIME Type Description Suffixes Enabled
application/x-shockwave-flash Shockwave Flash swf Yes
application/futuresplash FutureSplash Player spl Yes
NPAPI Plugins Wrapper 0.9.91.5
File name: npwrapper.so
nspluginwrapper is a cross-platform NPAPI plugin viewer, in particular for linux/i386 plugins.
This is beta software available under the terms of the GNU General Public License.
MIME Type Description Suffixes Enabled
unknown/mime-type Do not open none Yes
Java(TM) Plug-in 1.6.0_07-b06
File name: libjavaplugin_oji.so
Java(TM) Plug-in 1.6.0_07
MIME Type Description Suffixes Enabled
application/x-java-vm Java Yes
application/x-java-applet Java Yes
application/x-java-applet;version=1.1 Java Yes
application/x-java-applet;version=1.1.1 Java Yes
application/x-java-applet;version=1.1.2 Java Yes
application/x-java-applet;version=1.1.3 Java Yes
application/x-java-applet;version=1.2 Java Yes
application/x-java-applet;version=1.2.1 Java Yes
application/x-java-applet;version=1.2.2 Java Yes
application/x-java-applet;version=1.3 Java Yes
application/x-java-applet;version=1.3.1 Java Yes
application/x-java-applet;version=1.4 Java Yes
application/x-java-applet;version=1.4.1 Java Yes
application/x-java-applet;version=1.4.2 Java Yes
application/x-java-applet;version=1.5 Java Yes
application/x-java-applet;version=1.6 Java Yes
application/x-java-applet;jpi-version=1.6.0_07 Java Yes
application/x-java-bean Java Yes
application/x-java-bean;version=1.1 Java Yes
application/x-java-bean;version=1.1.1 Java Yes
application/x-java-bean;version=1.1.2 Java Yes
application/x-java-bean;version=1.1.3 Java Yes
application/x-java-bean;version=1.2 Java Yes
application/x-java-bean;version=1.2.1 Java Yes
application/x-java-bean;version=1.2.2 Java Yes
application/x-java-bean;version=1.3 Java Yes
application/x-java-bean;version=1.3.1 Java Yes
application/x-java-bean;version=1.4 Java Yes
application/x-java-bean;version=1.4.1 Java Yes
application/x-java-bean;version=1.4.2 Java Yes
application/x-java-bean;version=1.5 Java Yes
application/x-java-bean;version=1.6 Java Yes
application/x-java-bean;jpi-version=1.6.0_07 Java Yes
I'll post up the error message in a bit.
ETA: This is the error message
Edited by: sparrowDCLXVI on Nov 20, 2009 8:35 AM -
HelloWorldApp throws Exception in Main
Hi folks,
Can some one help me to get this working. It compiles fine but when i run using the
java HelloWorldApp
it throws this error
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
the program i am trying to run is
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); //Display the string.
Thanks
pavanPerhaps:
mkdir c:\java\classes
javac -d c:\java\classes YourClass.java
That'll put the output classes in the classes directory, which is cleaner anyway, rather than keeping them with your source.
Then set your classpath to include c:\java\classes -
how can i creat a folder at my code? that i want to save an omage in it?
java.io.File.mkdir() or mkdirs()
http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html -
Ant build script for WebLogic Portal 10.3 projects
Hi Friends,
I am going thru this document http://download.oracle.com/docs/cd/E12840_01/wlw/docs103/guide/ideuserguide/build/conUseCustomAntBuild.html#metadata about building ant script for my portal project. The document does not state few things clearly. Can you please help me to understand.
It says:
To Build an EAR File Using the Ant Script:
1. Generate the Ant script for each project in the EAR.
2. Generate the Ant script for the EAR project.
3. Configure the execution environment of your shell by executing wl.home/common/bin/commEnv.sh
4. Change to the Eclipse directory for the EAR project.
5. Execute the desired target in the EAR project's Ant script as follows:
ant build archive -Dworkspace=workspacepath
A) When I generate ant script, workshop generates build.xml file in each project directory and that includes EAR project as well. Then, point 2 is not clear, how do I generate another ant script (build.xml) for the EAR project?
B) I do not understand, "change to the eclipse directory for the EAR project". Does it mean, change to the directory of EAR project folder which has build.xml?
C) in step-5, execute the desired target, when I execute it, how it will know where are other build.xml files for other projects?
Regards,
JTHi Greg,
I moved little bit but then got stuck with new kind of error.
a. First of all, my application has a 'data' project (.usr) file. When I try to generate ant scripts (build.xml), it says that 'data' project is not compatible with Workshop ant scripts. However, Workshop inbuilt EXPORT->EAR is able to build the projects without any error.
b. So, I thought, let's put a dummy build.xml file under 'data' project directory. This let ant build to proceed further. However, now it fails with error that <web project>/build.xml (line no. 122). Which is nothing but memory declaration (memoryMaximumSize="1024m"). The error says, 'unable to launch apt compiler', I am not able to understand what is it? The other projects' (ejb, controls etc.) build.xml has this declaration but they did not give this error, they built fine.
<web project>/build.xml
<target name="build" depends="init" description="compiles the source files; does not package the results">
<if>
<isreference refid="apt.factory.path"/>
<then>
<mkdir dir="${apt.src.output.dir}"/>
<for-each-java-src-path>
<if>
<available file="${.java.src.dir}"/>
<then>
<mkdir dir="${.java.src.output}"/>
<apt
sourcepath="${java.sourcepath}"
srcdir="${.java.src.dir}"
includes="${.java.src.include}"
excludes="${.java.src.exclude}"
destdir="${.java.src.output}"
preprocessdir="${apt.src.output.dir}"
classpathref="java.classpath"
factorypathref="apt.factory.path"
options="${apt.options}"
compile="false"
memoryMaximumSize="1024m"/>
</then>
</if>
</for-each-java-src-path>
</then>
</if>
Regards,
JT
Edited by: user6917422 on Apr 1, 2009 9:29 PM
Edited by: user6917422 on Apr 1, 2009 9:57 PM -
Can you install both Oracle 10g XE (Express) and Oracle 10g Enterprise on the same laptop?
I've already installed Oracle 10g XE and it is working fine. However, I need to install 10g Enterprise to take another tutorial.
When I try to run the setup.exe for the 10g Enterprise I get an error. oui.exe has encountered a problem and needs to close. I don't know if this is related to the fact that I already have 10g Express installed. I did stop the 10g XE database before I started the install.I moved the isntall from a "My Downloads" directory path to a path no my C: drive with no spaces and the install wizard started up fine.
However, at the 78% mark it encountered an error:
Abnormal Program Termination. An interal error has occured. Please provide the following files to Oracle Support:
c:\Program Files\Oracle\Inventory\logs\installActions2009-05-20_03-26-18PM.log
c:\Program Files\Oracle\Inventory\logs\oraInstall2009-05-20_03-26-18PM.err
c:\Program Files\Oracle\Inventory\logs\oraInstall2009-05-20_03-26-18PM.out
I am including the contents of the files below (because of the size of the installActions log file I'm only including the start and end of the file):
installActions2009-05-20_03-26-18PM.log
Using paramFile: C:\Database\Oracle10gEnterprise\database\install\oraparam.ini
No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
The commandline for unzip:
C:\Database\Oracle10gEnterprise\database\install\unzip -qqq ../stage/Components/oracle.swd.jre/1.4.2.8.0/1/DataFiles/"*.jar" -d "C:\DOCUME~1\BEN~1.SIS\LOCALS~1\Temp\OraInstall2009-05-20_03-26-18PM"
The commandline for unzip:
C:\Database\Oracle10gEnterprise\database\install\unzip -qqq ..\stage\Components\oracle.swd.oui\10.2.0.1.0\1\DataFiles\/"*.jar" -d "C:\DOCUME~1\BEN~1.SIS\LOCALS~1\Temp\OraInstall2009-05-20_03-26-18PM"
The commandline for unzip:
C:\Database\Oracle10gEnterprise\database\install\unzip -qqq ..\stage\Components\oracle.swd.oui.core\10.2.0.1.0\1\DataFiles\/"*.jar" -d "C:\DOCUME~1\BEN~1.SIS\LOCALS~1\Temp\OraInstall2009-05-20_03-26-18PM"
The number of files bootstrapped for the jre is 584.
The number of files bootstrapped for the oui is 100.INFO: Environment Variables:
INFO: ORACLE_HOME =
INFO: PATH = C:\oraclexe\app\oracle;\oracle\product\10.2.0\db_1\bin;C:\OracleBI\server\Bin;C:\OracleBI\web\bin;C:\OracleBI\web\catalogmanager;C:\OracleBI\SQLAnywhere;C:\Program Files\Java\jdk1.6.0_12\bin;E:\oracle\product\10.2.0\client_1\bin;C:\XEClient\bin;C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\
INFO: CLASSPATH =
INFO: Username:Ben.Sisson
INFO: This installation is being performed using response file C:/Database/Oracle10gEnterprise/database/install/response/ee.rsp.
INFO: Oracle Universal Installer version is 10.2.0.1.0
*(Missing Information)*
INFO: Calling Query RepositoryQueries3.0.0.2.17 Obfuscate
InputString = Protected value, not to be logged
OracleHome = C:\oraclexe\app\oracle;\oracle\product\10.2.0\db_1
JavaLocation = null
JarLocation = null
INFO: Query Returned: Protected value, not to be logged
INFO: Setting variable 's_obfOc4jAdmPasswd' to '*Protected value, not to be logged*'. Received the value from a code block.
INFO: Calling Action fileActions10.2.0.0.0 instantiateFile
selectedNodes = null
source = C:\oraclexe\app\oracle;\oracle\product\10.2.0\db_1\oc4j\j2ee\\OC4J_DBConsole\config\jazn-data.xml
destination = C:\oraclexe\app\oracle;\oracle\product\10.2.0\db_1\oc4j\j2ee\\OC4J_DBConsole\config\jazn-data.xml
variables = null
INFO: Calling Action fileActions10.2.0.0.0 removeFile
selectedNodes = null
source = C:\oraclexe\app\oracle;\oracle\product\10.2.0\db_1\oc4j\j2ee\oc4j_applications\applications\em.ear
INFO: Calling Action fileActions10.2.0.0.0 removeFile
selectedNodes = null
source = C:\oraclexe\app\oracle;\oracle\product\10.2.0\db_1\oc4j\j2ee\oc4j_applications\applications\em\em.war
INFO: Calling Query globalVarQueries2.1.0.4.1 getGlobalVariable
variable = oracle.assistants.server.sid
INFO: Query Returned: orcl
INFO: Setting variable 's_sid' to 'orcl'. Received the value from a code block.
INFO: Setting variable 'b_launchBrowser' to 'true'. Received the value from a code block.
INFO: 5/20/09 3:31:41 PM EDT: Starting install Install Phase 2 of component Oracle Database 10g
INFO: Calling Action fileActions10.2.0.0.0 createDirRecurse
destination = C:\oraclexe\app\oracle;\oracle\product\10.2.0\db_1\oc4j\opmn\lib
selectedNodes = null
permissions = null
owner = null
group = null
INFO: Install Phase 2 JRE files in Scratch :584
INFO: Initializing OUI save inventory
INFO: The flags set for this home (E:\oracle\product\10.2.0\client_1) are:clean
SEVERE: Abnormal program termination. An internal error has occured. Please provide the following files to Oracle Support :
"C:\Program Files\Oracle\Inventory\logs\installActions2009-05-20_03-26-18PM.log"
"C:\Program Files\Oracle\Inventory\logs\oraInstall2009-05-20_03-26-18PM.err"
"C:\Program Files\Oracle\Inventory\logs\oraInstall2009-05-20_03-26-18PM.out"
oraInstall2009-05-20_03-26-18PM.err
Exception java.lang.NullPointerException occurred..
java.lang.NullPointerException
at java.io.File.<init>(Unknown Source)
at oracle.sysman.oii.oiip.oiipg.OiipgFileSystem.mkdirs(OiipgFileSystem.java:1117)
at oracle.sysman.oii.oiip.oiipg.OiipgFileSystem.mkdirs(OiipgFileSystem.java:1121)
at oracle.sysman.oii.oiip.oiipg.OiipgFileSystem.mkdirs(OiipgFileSystem.java:1121)
at oracle.sysman.oii.oiip.oiipg.OiipgFileSystem.mkdirs(OiipgFileSystem.java:1121)
at oracle.sysman.oii.oiip.oiipg.OiipgFileSystem.mkdirs(OiipgFileSystem.java:1121)
at oracle.sysman.oii.oiip.oiipg.OiipgFileSystem.mkdirs(OiipgFileSystem.java:1121)
at oracle.sysman.oii.oiip.oiipg.OiipgFileSystem.mkdirs(OiipgFileSystem.java:1121)
at oracle.sysman.oii.oiix.OiixFileOps.mkdirs(OiixFileOps.java:234)
at oracle.sysman.oii.oiii.OiiiOracleHomeInfoXMLWriter.writeHomeProperties(OiiiOracleHomeInfoXMLWriter.java:138)
at oracle.sysman.oii.oiii.OiiiOracleHomeInfoXMLWriter.updateHomeProperties(OiiiOracleHomeInfoXMLWriter.java:120)
at oracle.sysman.oii.oiii.OiiiInstallInventory.saveOHPropXML(OiiiInstallInventory.java:1323)
at oracle.sysman.oii.oiii.OiiiInstallInventory.saveInventory(OiiiInstallInventory.java:811)
at oracle.sysman.oii.oiii.OiiiInstallInventory.saveInventory(OiiiInstallInventory.java:849)
at oracle.sysman.oii.oiii.OiiiInstallAreaControl.writeInstallInv(OiiiInstallAreaControl.java:1284)
at oracle.sysman.oii.oiii.OiiiInstallAreaControl.saveInstallInventory(OiiiInstallAreaControl.java:1210)
at oracle.sysman.oii.oiii.OiiiInstallAreaControl.saveInstallInventory(OiiiInstallAreaControl.java:1113)
at oracle.sysman.oii.oiic.OiicInstallSession.saveInventoryWithUpdate(OiicInstallSession.java:2537)
at oracle.sysman.oii.oiic.OiicInstSaveInvWCCE.initialize(OiicInstSaveInvWCCE.java:156)
at oracle.sysman.oii.oiif.oiifb.OiifbCondIterator.iterate(OiifbCondIterator.java:152)
at oracle.sysman.oii.oiif.oiifw.OiifwActionsPhaseWCDE.doOperation(OiifwActionsPhaseWCDE.java:606)
at oracle.sysman.oii.oiif.oiifb.OiifbLinearIterator.iterate(OiifbLinearIterator.java:147)
at oracle.sysman.oii.oiic.OiicInstallSession$OiicSelCompsInstall.doOperation(OiicInstallSession.java:3772)
at oracle.sysman.oii.oiif.oiifb.OiifbCondIterator.iterate(OiifbCondIterator.java:171)
at oracle.sysman.oii.oiic.OiicPullSession.doOperation(OiicPullSession.java:1273)
at oracle.sysman.oii.oiic.OiicSessionWrapper.doOperation(OiicSessionWrapper.java:289)
at oracle.sysman.oii.oiic.OiicInstaller.run(OiicInstaller.java:547)
at oracle.sysman.oii.oiic.OiicInstaller.runInstaller(OiicInstaller.java:935)
at oracle.sysman.oio.oioc.OiocOneClickInstaller.runInstaller(OiocOneClickInstaller.java:1016)
at oracle.sysman.oio.oioc.OiocOneClickInstaller.startRun(OiocOneClickInstaller.java:1108)
at oracle.sysman.oio.oioc.OiocOneClickDB.nextClicked(OiocOneClickDB.java:1084)
at oracle.sysman.oio.oioc.OiocOneClickInstaller.main(OiocOneClickInstaller.java:1318)
oraInstall2009-05-20_03-26-18PM.out
toLoad is C:\DOCUME~1\BEN~1.SIS\LOCALS~1\Temp\OraInstall2009-05-20_03-26-18PM\ocxReg.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Assembly: Policy.10.1.Oracle.DataAccess, Version=10.2.0.100, Culture=neutral, PublicKeyToken=89b483f429c47342, Custom=null
Uninstalled: Policy.10.1.Oracle.DataAccess, Version=10.2.0.100, Culture=neutral, PublicKeyToken=89b483f429c47342, Custom=null
Number of items uninstalled = 1
Number of failures = 0
Microsoft (R) .NET Global Assembly Cache Utility. Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Assembly: Policy.9.2.Oracle.DataAccess, Version=10.2.0.100, Culture=neutral, PublicKeyToken=89b483f429c47342, Custom=null
Uninstalled: Policy.9.2.Oracle.DataAccess, Version=10.2.0.100, Culture=neutral, PublicKeyToken=89b483f429c47342, Custom=null
Number of items uninstalled = 1
Number of failures = 0
Microsoft (R) .NET Global Assembly Cache Utility. Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Assembly successfully added to the cache
Microsoft (R) .NET Global Assembly Cache Utility. Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Assembly successfully added to the cache
Microsoft (R) .NET Global Assembly Cache Utility. Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Assembly successfully added to the cache
Unable to load ORAIMR10.DLL -
The mkdir() function in java returning false. Why?
I am trying to create the folder archive under the following directory structure:
E:/preweb/CATest/DL/Zipra Internal/EventCompletion/html/archive/
using the boolean mkdir() function in java.
Though the folder archive does not exist under html folder, still the function is returning false.
Canm someone let me know why?And you have checked that by using
File file =// E:/preweb/CATest/DL/Zipra Internal/EventCompletion/html/archive/
Sys.out.println( file.getParentFile().exists() ); -
High CPU usage while running a java program
Hi All,
Need some input regarding one issue I am facing.
I have written a simple JAVA program that lists down all the files and directories under one root directory and then copies/replicates them to another location. I am using java.nio package for copying the files. When I am running the program, everything is working fine. But the process is eating up all the memories and the CPU usage is reaching upto 95-100%. So the whole system is getting slowed down.
Is there any way I can control the CPU usage? I want this program to run silently without affecting the system or its performance.Hi,
Below is the code snippets I am using,
For listing down files/directories:
static void Process(File aFile, File aFile2) {
spc_count++;
String spcs = "";
for (int i = 0; i < spc_count; i++)
spcs += "-";
if(aFile.isFile()) {
System.out.println(spcs + "[FILE] " + aFile2.toURI().relativize(aFile.toURI()).getPath());
String newFile = dest + aFile2.toURI().relativize(aFile.toURI()).getPath();
File nf = new File(newFile);
try {
FileCopy.copyFile(aFile ,nf);
} catch (IOException ex) {
Logger.getLogger(ContentList.class.getName()).log(Level.SEVERE, null, ex);
} else if (aFile.isDirectory()) {
//System.out.println(spcs + "[DIR] " + aFile2.toURI().relativize(aFile.toURI()).getPath());
String newDir = dest + aFile2.toURI().relativize(aFile.toURI()).getPath();
File nd = new File(newDir);
nd.mkdir();
File[] listOfFiles = aFile.listFiles();
if(listOfFiles!=null) {
for (int i = 0; i < listOfFiles.length; i++)
Process(listOfFiles, aFile2);
} else {
System.out.println(spcs + " [ACCESS DENIED]");
spc_count--;
for copying files/directories:public static void copyFile(File in, File out)
throws IOException {
FileChannel inChannel = new
FileInputStream(in).getChannel();
FileChannel outChannel = new
FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(),
outChannel);
catch (IOException e) {
throw e;
finally {
if (inChannel != null) inChannel.close();
if (outChannel != null) outChannel.close();
Please let me know if any better approach is there. But as I already said, currently it's eating up the whole memory.
Thanks in advance. -
Trying to use Java Stored Procedure to create directories
Hello, I have the followqing simple Java code I am using to run OS commands from PL SQL. When I call my function, it does not create the directory, but it does say completed successfully. Here is the code and the call I am using:
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED Command
AS
import java.io.*;
import java.util.*;
public class Command{
public static void run(String cmdText)
throws IOException, InterruptedException
try {
int rtn;
Runtime rt = Runtime.getRuntime();
Process prcs = rt.exec(cmdText);
rtn = prcs.waitFor();
catch ( Throwable ex ) {
ex.printStackTrace();
CREATE OR REPLACE FUNCTION runoscommand(cmd IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME 'Command.run(java.lang.String) return int';
DECLARE
v_directory VARCHAR2(100):= 'C:\SYSTEM Interface\PL\files\';
v_rtn VARCHAR2(2000);
v_oscmd VARCHAR2(420);
BEGIN
v_oscmd := 'mkdir "' || v_directory || '"';
dbms_output.put_line(v_oscmd);
SELECT runoscommand(v_oscmd) INTO v_rtn FROM DUAL;
dbms_output.put_line(v_rtn);
END;
/Any ides on why this is not working? Any better suggestions for doing this? I need to be able to create directories from with in a PL SQL Stored Procedure. Thank youSimple dude, you java code returns void, whereas your function returns an int. Change the java code to return an int (and return an int)
-
Check java on users PC and give message
The following code has been written with Java 1.4 and works great, but if a user has Java 1.3 they get an error message and if a user has Java 1.2 nothing happens at all. Is there a way to check if the user is using a version older than 1.4 and if so pop up a message telling them they need to download a newer version of Java?
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.List;
import java.io.*;
import java.util.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import org.w3c.dom.*;
public class Sametime extends JFrame implements ActionListener {
private int indentation = -1;
JPanel panel = new JPanel();
JTextArea jta = new JTextArea(
//Instructions for user
"For a successful buddy list migration do the following:\n"
+ "1. Save your current Sametime Buddy List to your PC.\n "
+ "The default location should be: C:/Program Files/Lotus/Sametime Client.\n"
+ " A. Open the Sametime Client.\n"
+ " B. Click on People\n"
+ " C. Click on Save List.\n"
+ " D. Save as your first.last.dat\n"
+ " Ex. john.doe.dat\n"
+ "NOTE: If you have AOL contacts in your Sametime buddy list they will not be migrated.\n");
JButton browse = new JButton("Continue");
JButton exit = new JButton("Exit");
public Sametime() {
super("Sametime Buddy List Migration");
setSize(610, 245);
Container c = this.getContentPane();
c.add(panel);
browse.addActionListener(this);
exit.addActionListener(this);
panel.add(jta);
panel.add(browse);
panel.add(exit);
jta.setEditable(false);
setLookAndFeel();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} //end Sametime
public class DATFilter extends javax.swing.filechooser.FileFilter {
public boolean accept(File f) {
//if it is a directory -- we want to show it so return true.
if (f.isDirectory())
return true;
String extension = getExtension(f);//get the extension of the file
//check to see if the extension is equal to "dat"
if ((extension.equals("dat")))
return true;
//default -- fall through. False is return on all
//occasions except:
//a) the file is a directory
//b) the file's extension is what we are looking for.
return false;
}//end accept
public String getDescription() {
return "dat files";
}//end getDescription
* Method to get the extension of the file, in lowercase
private String getExtension(File f) {
String s = f.getName();
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1)
return s.substring(i+1).toLowerCase();
return "";
}//end getExtension
}//end class DATFilter
public void actionPerformed(ActionEvent e) {
//Default Location for JFileChooser search
String error = "The file selected is not a .dat file!\n"
+ "Please select your recently saved .dat file and try again.";
JFileChooser fc = new JFileChooser("/Program Files/Lotus/Sametime Client");
fc.setFileFilter(new DATFilter());
fc.setFileSelectionMode( JFileChooser.FILES_ONLY);
String user = System.getProperty("user.name");// finds who the current user is
if (e.getSource() == browse) {
int returnVal = fc.showSaveDialog(Sametime.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
//if (fc.getSelectedFile().getName().equals(".dat")){
if (fc.getSelectedFile().getName().endsWith(".dat")){ // checks to see if selected file is .dat
}else{
JOptionPane.showMessageDialog(null, error, "Wrong File", JOptionPane.ERROR_MESSAGE);
return;
}//end else
try {
String[] contactArray = parseDatFile(fc.getSelectedFile());
Document document = createXMLDocument(contactArray);
saveToXMLFile(
document,
new File(
"C:/Documents and Settings/" + user +"/My Documents/OLCS/",// looks for directory for list
"contacts-list_migration.ctt"));
} catch (Exception exc) {
File f = new File("C:/Documents and Settings/" + user +"/My Documents/OLCS/");// setting directory for list if not there
boolean yes = true;
yes = f.mkdir();// creating directory
try {
String[] contactArray = parseDatFile(fc.getSelectedFile());
Document document = createXMLDocument(contactArray);
saveToXMLFile(
document,
new File(
"C:/Documents and Settings/" + user +"/My Documents/OLCS/",// used only if the directory didn't exist
"contacts-list_migration.ctt"));
//exc.printStackTrace();// not sure if this is needed?
} catch (Exception exc1) {
exc1.printStackTrace();
}//end inner catch
}// end catch
}// end if
if(returnVal==JFileChooser.CANCEL_OPTION){
String Warning = "You did not migrate your Sametime buddy list at this time.";
JOptionPane.showMessageDialog(null, Warning, "Migration Canceled", JOptionPane.WARNING_MESSAGE);
return;
}else{
String thankyou = "Thank You for Migrating your Sametime buddy list to OLCS"
+ "\nYour new OLCS buddy list has been saved to:"
+ "\nC:/Documents and Settings/" + user +"/My Documents/OLCS"
+ "\n as: Contact-List_migration.ctt"
+ "\n\n To be able to use Contact-List_migration.ctt for Windows Messenger:"
+ "\n1. Log into Windows Messenger."
+ "\n2. Click on File"
+ "\n3. Click on 'Import Contacts from a Saved File...'"
+ "\n4. Open OLCS in My Documents"
+ "\n5. Click on 'Contact-list_migration.ctt'"
+ "\n6. Click Open to import the list."
+ "\n A window will pop up confirming that you want to add all of the contacts"
+ "\n Click 'yes'"
+ "\n Your buddy list is ready to be used.";
JOptionPane.showMessageDialog(null, thankyou, "Migration Completed", JOptionPane.INFORMATION_MESSAGE);//Change this when defualt directory is known.
}//end if else statement
} //end if
System.exit( 0 );
if (e.getSource() == exit) {
System.exit( 0 );
} //end if
} //end actionPerformed
String[] parseDatFile(File datFile)
throws Exception {
List list = new ArrayList();
BufferedReader br = new BufferedReader(new FileReader(datFile));
String line;
while ((line = br.readLine()) != null) {
line = line.trim();
if (line.indexOf("U") != 0)
continue;
int p = line.indexOf("::");
if (p == -1)
continue;
line = line.substring(p + 2).trim();
if (line.indexOf("AOL") == 0)
continue;
p = line.indexOf(",");
if (p != -1)
line = line.substring(0, p);
line = line.trim() + "@mci.com";
if (list.indexOf(line) == -1)
list.add(line);
}//end while
br.close();
String[] contactArray = new String[list.size()];
list.toArray(contactArray);
return contactArray;
}// end String
// setting up the XML file
Document createXMLDocument(String[] contactArray) throws Exception {
DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dBF.newDocumentBuilder();
DOMImplementation domImpl = builder.getDOMImplementation();
Document document = domImpl.createDocument(null, "messenger", null);
Element root = document.getDocumentElement();
Element svcElm = document.createElement("service");
Element clElm = document.createElement("contactlist");
svcElm.setAttribute("name", "Microsoft RTC Instant Messaging");
svcElm.appendChild(clElm);
root.appendChild(svcElm);
for (int i = 0; i < contactArray.length; i++) {
Element conElm = document.createElement("contact");
Text conTxt = document.createTextNode(contactArray);
conElm.appendChild(conTxt);
clElm.appendChild(conElm);
}//end for
return document;
}// end Document
void saveToXMLFile(Document document, File xmlFile) throws Exception {
OutputStream os =
new BufferedOutputStream(new FileOutputStream(xmlFile));
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");//puts information on seperate lines
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");//gives the XML file indentation
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(os);
transformer.transform(source, result);
os.close();
}//end saveToXMLFile
public static void main(String[] args) {
Sametime st = new Sametime();
ImageIcon picIcon = new ImageIcon(st.getClass().getResource("/ST_Migration/images/mci.gif"));//Change when default is known!
st.setIconImage(picIcon.getImage());
} //end main
private void setLookAndFeel() {
try {
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(this);
} catch (Exception e) {
System.err.println("Could not use Look and Feel: " + e);
} //end catch
} //end void setLookAndFeel
} //end public class SametimeWell, if you don't want to use Package.isCompatibleWith and the version numbers will always be of the form x.y where y is at most one digit, you can use Double.parseDouble() and then compare the numbers. Otherwise you need to write a method of your own.
Maybe you are looking for
-
LG Ally - deleting pop3 emails from trash folder
I have three pop3 email accounts set up on my LG Ally. All work great - however, deleting the all the emails in the trash folder is cumbersome. Is there a way to delete all the emails in the "trash folder" at one? I can only seem to delete them by t
-
Problem with 'Authorized Reseller' how do I complain to Verizon?
I have had a horrible experience with my local "Verizon Authorized Reseller". We have been with Verizon for a CRAZY amount of time - well over a decade at least, and have generally used the corporate stores wherever possible. Affiliate retailers ho
-
Hi, I have SCM installed in R12 and I need to set up SCM and Procurement. Could someone advice me which document I need to follow. Expectgin help from experts. Thanks Seb
-
Error D4O-1007 Discoverer Plus
Hi, When I create a time dimension in the AWM. The I try to connect to Discoverer PLus and get this message "D4O-1007 An error occurred in Oracle OLAP during the execution of the query" Why??? Thanks a lot
-
How to reset password on wifi to use facetime
how can i reset my password in wifi to use facetime?