出于安全考虑,我需要找到一种方法来限制JVM将运行的文件.我有大约5个可以运行的jar,其他任何东西都不能在JVM上运行.这是由于某些特定于域的限制,其中必须将特定权限分配给JVM,但是这些权限不应该对任何想要编写和执行java文件的人可用.
我觉得在JVM中只运行可信/签名代码可能有某种功能,但我无法找到任何相关信息.
如果有人有任何想法会很棒!
我想知道是否有办法返回在我实际执行查询时生成的结果集(Oracle数据库,在Java中)的列名.例如,假设我的SQL看起来像这样:
select * from <complex table join>;
Run Code Online (Sandbox Code Playgroud)
有没有办法将此查询发送到oracle并让它告诉我结果集中的列名是什么,它将返回而不实际执行查询(因为它很昂贵)?
我需要做的是能够阻止从一个实现runnable的线程类运行的所有线程.这就是我的意思:这是我的"线程"类的开头:
public class HTTP extends Thread
{
int threadNumber;
String host;
int port;
int timeLeft;
private BufferedReader LocalBufferedReader;
public HTTP(int threadNumber, String host, int port, int timeLeft)
{
this.threadNumber = threadNumber;
this.host= host;
this.port = port;
this.timeLeft = (timeLeft * 1000);
}
public void run()
{
Run Code Online (Sandbox Code Playgroud)
这是我创建多个线程来执行此操作的方式:
for (int n = 1; n <= m; n++) {
new HTTP(n + 1, str, j, k).start();
}
Run Code Online (Sandbox Code Playgroud)
m是要创建的线程数.这可以是50-1000.现在我需要做的就是突然停止所有这些.我怎样才能做到这一点?
我正在尝试从源代码构建openjdk,我在ubuntu 12.04上的openjdk6上使用"HOTSPOT_RELEASE_VERSION = 20.0-b12".它提示:
This OS is not supported:" `uname -a`; exit 1;<br>
This OS is not supported: Linux joker-Inspiron-1545 3.2.0-35-generic-pae #55-Ubuntu SMP Wed Dec 5 18:04:39 UTC 2012 i686 i686 i386 GNU/Linux.
Run Code Online (Sandbox Code Playgroud)
有人可以指导我吗?
这听起来像一个愚蠢的问题,但我真的很困惑.我从未使用过maven,但我知道它用于构建项目.
所以,我有一个问题:当我们可以在Eclipse中构建项目(没有Maven)时,为什么需要使用Maven构建项目.只需将eclipse项目导出为JAR并包含所需的库和所有项目.
假设,我从github下载任何项目.现在我可以在eclipse中导入该项目并将其导出为JAR并使用它的功能.那么为什么所有人都建议使用MAVEN来构建项目并生成二进制文件并使用它.
我正在开发一个Struts应用程序.
为了编辑struts-config.xml文件,我想我必须scope在action标签中添加一个属性.我不确定它的含义或用法.
<action path="/WetsVpnSwapTraffic"
type="com.kpn.bop.web.action.vpn.wets.WetsVpnSwapTraffic"
scope="request"
name="WetsVpnSwapTrafficForm"
roles="bop_wetsvpn_migrate"
validate="false">
<forward name="success" path="/WetsVpnSwapTrafficValidate.do"/>
<forward name="failure" path="/WetsVpnList.do"/>
</action>
Run Code Online (Sandbox Code Playgroud)
任何人都可以解释我是否必须提出这个属性?
我在OS X Lion上构建hmatrix库时遇到了麻烦.查看.cabal文件,它需要gsl库,所以我用macports安装它..a文件位于/ opt/local/lib中,.h文件位于/ opt/local/include/gsl中
正如这里建议的那样, 我将内置类型从Custom更改为Simple.(没有那个改变我得到了类似的错误).
当我使用时,cabal configure我得到以下输出:
* Missing C library: gsl
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
Run Code Online (Sandbox Code Playgroud)
所以我试过cabal --extra-include-dirs=/opt/local/include --extra-lib-dirs=/opt/local/lib configure,但我仍然得到同样的错误.我可以编译和链接包含gsl的ac程序.cabal寻找什么文件?如果我有正确的文件,我该如何告诉它如何找到它们?
libgsl.a是一个通用二进制文件:
$ file /opt/local/lib/libgsl.a
/opt/local/lib/libgsl.a: …Run Code Online (Sandbox Code Playgroud) 我在这里有一个数据库设计,在简化版本中看起来:
表building:
那里的数据是这样的:
表格attribute1_values和attribute2_values结构如下:
其中包含以下信息:
我不确定这是否是最好的设置,但它是按照我的项目经理的要求完成的.它肯定有一些道理,因为你现在可以轻松地修改文本而不会弄乱id.
但是现在我来到一个页面,我需要列出属性,那么我该如何去那里?我看到两个主要选择:
1)创建一个大的查询,从中收集所有值,building同时从attribute{x}_values表中选择正确的文本表示.
2)创建一个小的查询,从building表中收集所有值.然后在那之后一次获得一个属性的文本表示.
选择的最佳选择是什么?选项1是否更快作为选项2?如果是这样,是否值得维护额外的麻烦?
我发现在JDK 1.6或更高版本的HashMap类中,与之前的JDK版本(如1.5)相比,一些代码被更改为null.
在JDK1.5中,定义了一个名为NULL_KEY的静态最终Object :static final Object NULL_KEY = new Object();
方法,其中包括maskNull,unmaskNull,get和put等,将使用该对象.
看到
static final Object NULL_KEY = new Object();
static <T> T maskNull(T key) {
return key == null ? (T)NULL_KEY : key;
}
static <T> T unmaskNull(T key) {
return (key == NULL_KEY ? null : key);
}
public V get(Object key) {
Object k = maskNull(key);
int hash = hash(k);
int i = indexFor(hash, table.length); …Run Code Online (Sandbox Code Playgroud) Anybody/Mentors/Guru可以帮我解决这个问题吗?我通过注释1坚持了2天以上的Java代码:我在SSH中遇到了这个错误"createCriteria无效,没有活动事务"
Struts 2.3.15和Spring 3.2.4&Hibernate 4.2.5 Final
请查看以下详细错误:
Struts Problem Report
Struts has detected an unhanded exception:
Messages: createCriteria is not valid without active transaction
File: org/hibernate/context/internal/ThreadLocalSessionContext.java
Line number: 348
Run Code Online (Sandbox Code Playgroud)
踪迹:
org.hibernate.HibernateException: createCriteria is not valid without active transaction
org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:348)
$Proxy35.createCriteria(Unknown Source)
org.zenith.dao.impl.AnswerDAOImpl.listAll(AnswerDAOImpl.java:87)
org.zenith.service.aft.impl.AftAnswerServiceImpl.list(AftAnswerServiceImpl.java:35)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
$Proxy23.list(Unknown Source)
org.zenith.action.aft.AftAnswerAction.list(AftAnswerAction.java:60)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) …Run Code Online (Sandbox Code Playgroud)